为什么setsetOnScrollChangeListener不起作用。我已将nestedscrollview定义为。有时它确实有效,但大部分时间即使没有任何代码更改也无法正常工作。
<android.support.v4.widget.NestedScrollView
android:id="@+id/lvToDoList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v4.widget.NestedScrollView>
scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
Log.v("scrollx ",Integer.toString(scrollX));
Log.v("scrollY ",Integer.toString(scrollY));
Log.v("oldScrollX ",Integer.toString(oldScrollX));
Log.v("oldScrollY ",Integer.toString(oldScrollY));
if (scrollY>oldScrollY)
fabBG1.hide();
else
fabBG1.show();
}
});
任何提示?