天天看點

NestedScrollView替代了ScrollView解決嵌套難題

NestedScrollView替代了ScrollView 解決嵌套問題

引入 compile ‘com.android.support:design:24.2.1’
<android.support.v4.widget.NestedScrollView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scrollbars="none"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

         <android.support.v7.widget.RecyclerView
                            android:id="@+id/search_con_rv"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            >

         </android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
           

RecyclerView滑動有粘滞的感覺,此時,隻要給RecyclerView設定:

mRecyclerView.setNestedScrollingEnabled(false);

繼續閱讀