public SlidingMenu(Context context,AttributeSet attrs)
{
this(context,attrs,0);
}
(粗体区域报错)
public SlidingMenu(Context context, AttributeSet attrs, int defStyleAttr,
int defStyle) {
super(context,attrs,defStyle);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
R.styleable.SlidingMenu,defStyle,0);
int n = a.getIndexCount();
for(int i = 0;i<n;i++)
{
int attr = a.getIndex(i);
switch (attr)
{
case R.styleable.SlidingMenu_rightPadding:
mMenuRightPadding = a.getDimensionPixelSize(attr, (int)TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,50,context.getResources()
.getDisplayMetrics()));
break;
}
}
a.recycle();
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
mScreenWidth = outMetrics.widthPixels;
}