在滾動的視圖觀測滾動事件的Android庫:Android-ObservableScrollView
在滾動的視圖觀測滾動事件的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(); } } }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!