布局中有几个自定义的VIew和一个RecyclerView,滑动RecyclerView的时候相关显示会直接覆盖到其他的View之上。
对应布局文件如下:
<LinearLayout
android:orientation="vertical"
android:background="@color/spro_children_backgroud"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:attr/listDivider"
android:layout_above="@id/ll_bt"
android:layout_alignParentTop="true"
android:dividerPadding="12dp">
<Toolbar
android:theme="?android:attr/actionBarTheme"
android:id="@+id/action_bar"
android:layout_width="match_parent"
android:layout_height="45dp"
android:navigationContentDescription="@*android:string/ssl_ca_cert_noti_by_administrator"/>
<View
android:background="@color/spro_children_divider_color"
android:layout_width="match_parent"
android:layout_height="1dp"/>
<com.android.settings.childrenspace.SwitchPreferenceView
android:id="@+id/sp_allow_lock_screen"
android:layout_width="match_parent"
android:layout_height="50dp"
settings:children_title="@string/allow_lock_screen"/>
<com.android.settings.childrenspace.ChoosePreferenceView
android:id="@+id/cp_children_space_time"
android:layout_width="match_parent"
android:layout_height="50dp"
settings:children_title="@string/children_space_time"/>
<com.android.settings.childrenspace.SwitchPreferenceView
android:id="@+id/sp_close_network"
android:layout_width="match_parent"
android:layout_height="50dp"
settings:children_title="@string/close_network"/>
<com.android.settings.childrenspace.PreferenceView
android:id="@+id/access_app"
android:layout_width="match_parent"
android:layout_height="wrap_content"
settings:children_summary="@string/access_app"
settings:children_title="@string/access_app"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:id="@+id/list_container"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_app"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<include layout="@layout/loading_container"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:gravity="bottom"
android:orientation="vertical"
android:id="@+id/ll_bt"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true">
<View
android:background="@color/spro_children_divider_color"
android:layout_width="match_parent"
android:layout_height="1px"/>
<Button
android:textSize="16sp"
android:textColor="@color/spro_children_btn_color"
android:layout_gravity="center"
android:id="@+id/bt_children_space"
android:background="@color/spro_children_backgroud"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/enter_children_space"
android:textAllCaps="false"/>
</LinearLayout>
###### 运行结果及报错内容RecyclerView滑动过程中内容不会覆盖上面的View显示的内容
这个是你的布局有问题导致的,recycle view的布局太大了,把它放在几个按钮下面那样就不会出现这种情况了。