在滚动的视图观测滚动事件的Android库:Android-ObservableScrollView
jopen
11年前
在滚动的视图观测滚动事件的Android库
它易于与在Android 5.0 Lollipop中引入的工具条Toolbar相交互,并能够帮助实现Material Design apps的外观。
支持的控件
| Widget | Since | Note |
|---|---|---|
| ListView | v1.0.0 | |
| ScrollView | v1.0.0 | |
| WebView | v1.0.0 | |
| RecyclerView | v1.1.0 | It's supported but RecyclerView provides scroll states and position with OnScrollListener. You should use it if you don't have any reason. |
| GridView | - |
@Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { ActionBar ab = getSupportActionBar(); if (scrollState == ScrollState.UP) { if (ab.isShowing()) { ab.hide(); } } else if (scrollState == ScrollState.DOWN) { if (!ab.isShowing()) { ab.show(); } } }



