-
異常情況
普通Scrollview 嵌套RecyclerView 時,當recycerview數據量比較大,加載完數據後,會出現頁面自動定位到recyclerview的位置導致頁面自動滑動了。 -
解決
在Scrollview 根佈局 加上 android:descendantFocusability="blocksDescendants"屬性
<RelativeLayout 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:id="@+id/rl_clean_mainpage_all"
android:layout_width="match_parent"
android:descendantFocusability="blocksDescendants"
android:layout_height="match_parent"
android:background="@drawable/clean_theme_pic_skin">