通过getLayoutParams().width和getMeasuredWidth()获取的宽度为什么不一样
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
View menuView=getChildAt(0);//得到menu控件
menuView.measure(menuView.getLayoutParams().width,heightMeasureSpec);
System.out.println("布局宽度-----------"+menuView.getLayoutParams().width);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
protected void onLayout(boolean changed, int l, int t, int r, int b) {
View menuView=getChildAt(0);
menuView.layout(-menuView.getLayoutParams().width,t,0,b);
menuWidth = menuView.getLayoutParams().width;
System.out.println("getMeasured宽度:::::"+menuView.getMeasuredWidth());
}