bingoogolapple / bingoogolapple.github.io

个人主页。同时也通过 Issues 记录学习笔记
http://www.bingoogolapple.cn
86 stars 19 forks source link

getMeasuredHeight()与getHeight的区别 #67

Open bingoogolapple opened 9 years ago

bingoogolapple commented 9 years ago

当屏幕可以包裹内容的时候,他们的值相等,只有当view超出屏幕后,才能看出他们的区别

getMeasuredHeight()是实际View的大小,与屏幕无关

getHeight的大小此时则是屏幕的大小

当超出屏幕后,getMeasuredHeight()等于getHeight()加上屏幕之外没有显示的大小

view.measure(0, 0)后getHeight()为0,getMeasuredHeight()为实际View大小