Android 一张图理解getWidth和getMeasuredWidth
2013-06-19 10:29
387 查看
实际上在当屏幕可以包裹内容的时候,他们的值相等,只有当view超出屏幕后,才能看出他们的区别:getMeasuredHeight()是实际View的大小,与屏幕无关,而getHeight的大小此时则是屏幕的大小。当超出屏幕后,[b]getMeasuredHeight()等于getHeight()加上屏幕之外没有显示的大小[/b]
getwidth() is used to get width of view that has drawn like (view.getwidth() or view.getheight()).getwidth
onLayout()has been called.
getMeasureWidth() is used to get width of view that not drawn yet. like getmeasuredwidth() and getmeasureheight(). example : First call measure view.measure(0,0) and then u can use it with getmeasuredwidth() and getmeasureheight().
should not use getwidth/getHeight the values within onMeasure() or getMeasureWidth
offered or would like to have, not necessarily the ones it actually ends up getting.
http://www.cnblogs.com/zhuqiang/archive/2013/03/10/2952797.html http://blog.sina.com.cn/s/blog_6e519585010152s5.html http://blog.csdn.net/chongshi007/article/details/8985063 http://blog.csdn.net/johnny901114/article/details/7839512 http://www.bdqn.cn/news/201304/8749.shtml
getwidth() is used to get width of view that has drawn like (view.getwidth() or view.getheight()).getwidth
()and getHeight
()will only be populated after the Layout Phase, that is after
onLayout()has been called.
getMeasureWidth() is used to get width of view that not drawn yet. like getmeasuredwidth() and getmeasureheight(). example : First call measure view.measure(0,0) and then u can use it with getmeasuredwidth() and getmeasureheight().
should not use getwidth/getHeight the values within onMeasure() or getMeasureWidth
()/getMeasureWidth
(), since those are only the dimensions the View is initially
offered or would like to have, not necessarily the ones it actually ends up getting.
http://www.cnblogs.com/zhuqiang/archive/2013/03/10/2952797.html http://blog.sina.com.cn/s/blog_6e519585010152s5.html http://blog.csdn.net/chongshi007/article/details/8985063 http://blog.csdn.net/johnny901114/article/details/7839512 http://www.bdqn.cn/news/201304/8749.shtml
相关文章推荐
- Android 一张图理解getWidth和getMeasuredWidth
- Android-- 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- Android 一张图理解getWidth和getMeasuredWidth
- (4.1.36.11)Android 一张图理解getWidth和getMeasuredWidth
- Android中View窗体getWidth和getMeasuredWidth的区别
- Android 关于view的getLayoutParams().width,getWidth(),getMeasuredWidth();
- Android开发之getMeasuredWidth和getWidth区别从源码分析
- Android 一张图理解getWidth…
- Android 对getWidth和getMeasuredWidth 的理解
- Android 关于view的getLayoutParams().width,getWidth(),getMeasuredWidth();
- Android开发之getMeasuredWidth和getWidth区别从源码分析
- Android开发之getMeasuredWidth和getWidth区别从源码分析
- Android getWidth和getMeasuredWidth的理解