我有这个代码,我在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);
}
答案 0 :(得分:0)
通常在滚动更改ListView上的工作..
因此,当您在listview的监听器中调用
时,GetChildView()将无法工作您可以在侦听器外部尝试此方法,并使用侦听器内的值...