Android自定义控件中getWidth和getMeasureWidth的区别

 

①getMeasuredWidth方法获得的值是setMeasuredDimension方法设置的值,它的值在measure方法运行后就会确定


②getWidth方法获得是layout方法中传递的四个参数中的mRight-mLeft,它的值是在layout方法运行后确定的


③一般情况下在onLayout方法中使用getMeasuredWidth方法,而在除onLayout方法之外的地方用getWidth方法。
posted @ 2017-12-06 16:15  西红柿里没有番茄  阅读(535)  评论(0编辑  收藏  举报