getWidth() Return the width of the your view. Returns The width of your view, in pixels. 源代码: public final int getWidth() { return mRight - mLeft; } getwidth返回的是右边坐标减轻坐标减去左边坐标,这要在布局之后才能确定它们的坐标,也就是说在布局后才能调用getwidth来获取.所以getWidth()获得的宽度是View在设定好布局后整个Vi…
getWidth() Return the width of the your view. Returns The width of your view, in pixels. 源代码: public final int getWidth() { return mRight - mLeft; } getwidth返回的是右边坐标减轻坐标减去左边坐标,这要在布局之后才能确定它们的坐标,也就是说在布局后才能调用getwidth来获取.所以getWidth()获得的宽度是View在设定好布局后整个Vi…