0
我有這個代碼,我得到了與getChildCount()
和最後一行上的2錯誤。檢查底部是否達到滾動視圖的方法
protected void onScrollChanged(int l, int t, int oldl, int oldt)
{
// Grab the last child placed in the ScrollView, we need it to determinate the bottom position.
View view = (View) getChildAt(getChildCount()-1);
// Calculate the scrolldiff
int diff = (view.getBottom()-(view.getHeight()+view.getScrollY()));
// if diff is zero, then the bottom has been reached
if(diff == 0)
{
// notify that we have reached the bottom
Log.d("Hier", "MyScrollView: Bottom has been reached");
}
super.onScrollChanged(l, t, oldl, oldt);
}
'scrollview.getChildCount() - 1'我在getChildAt(..) – jamalM 2013-04-28 18:53:40