1. 程式人生 > >getMeasuredHeight() getHeight() getScrollY() 含義

getMeasuredHeight() getHeight() getScrollY() 含義

getMeasuredHeight()   代表該view的實際高度  

getHeight()    代表該view的顯示在螢幕中的高度

getScrollY()   代表 父類parentview 左上角 在view中位置         

案例分析:

scrollview  是否滑動到底部?

@Override
public boolean isAtBottom() {
int scrollY = mcoyScrollView.getScrollY();    
int height = mcoyScrollView.getHeight();
int scrollViewMeasuredHeight = mcoyScrollView.getChildAt(0).getMeasuredHeight();
if ((scrollY + height) >= scrollViewMeasuredHeight) {
return true;
}
return false;
}


參考文章:*         http://blog.csdn.net/bigconvience/article/details/26697645
 *         http://blog.csdn.net/androiddevelop/article/details/8373782
 *         http://blog.csdn.net/xujainxing/article/details/8985063