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