创建了Bottom Navigation Views Activity之后,在fragment_home.xml,加了一个RecyclerView,
后来添加了item之后发现底部会被盖住一部分。
解决:在layout里面加两句:
android:paddingBottom="?attr/actionBarSize"
android:clipToPadding="false"
如下
- "1.0" encoding="utf-8"?>
- <androidx.constraintlayout.widget.ConstraintLayout 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"
- tools:context=".ui.home.HomeFragment"
- android:paddingBottom="?attr/actionBarSize"
- android:clipToPadding="false"
- >
-
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/recycler_view"
- android:layout_width="0dp"
- android:layout_height="0dp"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- />
-
- androidx.constraintlayout.widget.ConstraintLayout>