在工作中遇到要实现会弹性滑动的NestedScrollView的需求,于是自己就在NestedScrollView的源码基础上修改得到OverNestedScrollView,使用方法和NestedScrollView一模一样,具体效果如下:
![效果图](https://i-blog.csdnimg.cn/blog_migrate/767bc17c06ce54ccf58257b2fa42ce4e.gif)
使用例子如下:
xml:
<com.huchenhao.overnestedscrollview.base.OverNestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" android:overScrollMode="ifContentScrolls" android:scrollbarStyle="outsideOverlay" android:scrollbars="vertical" > <android.support.v7.widget.RecyclerView android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="wrap_content" /> </com.huchenhao.overnestedscrollview.base.OverNestedScrollView>
code:
recyclerView.setNestedScrollingEnabled(false);