[英]How to detect Scroll view Direction in Android
Anyone know how to detect ScrollView direction because I have to show and hide ActionBar on scrolling? 有人知道如何检测ScrollView方向,因为我必须在滚动时显示和隐藏ActionBar? I can easily detect with help of listview but don't know about ScrollView.
我可以借助listview轻松检测到,但不了解ScrollView。
you can extend the scrollView
because scrollview
doesnt have such listener. 您可以扩展
scrollView
因为scrollview
没有此类侦听器。 just extend the scrolView and call your callback from the overrided onScrollChanged method. 只需扩展scrolView并从覆盖的onScrollChanged方法中调用您的回调即可。
then in your xml file use your CustomScrollView like this: 然后在xml文件中使用CustomScrollView,如下所示:
<my.package.CustomScrollView>xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.