bob*_* I. 5 android android-recyclerview bottomnavigationview
所以,我有这个问题。我的底部导航涵盖了我的最后一项 recyclerview。底部导航处于活动状态。recyclerview 在片段中。我没有找到答案。
这是我的片段布局,其中包含 recyclerview
<android.support.constraint.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="wrap_content"
tools:context=".PromoFragment">
<!-- TODO: Update blank fragment layout -->
<android.support.v7.widget.RecyclerView
android:id="@+id/promo_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="110dp">
</android.support.v7.widget.RecyclerView>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
这是我在 recyclerview 中使用的项目布局
<android.support.constraint.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="wrap_content"
android:orientation="vertical"
android:padding="5px">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:id="@+id/card_pertama"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="@layout/card_promo_layout"/>
</android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的代码结果的图像
添加android:paddingBottom="56dp"到Fragment包含RecyclerView或最接近的父布局RecyclerView。例如:
<android.support.constraint.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="wrap_content"
android:paddingBottom="56dp"
tools:context=".PromoFragment">
<!-- TODO: Update blank fragment layout -->
<android.support.v7.widget.RecyclerView
android:id="@+id/promo_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</android.support.v7.widget.RecyclerView>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
BottomNavigationViewPS 56dp - 是根据 Material Design的高度。所以 的值paddingBottom必须与 的高度相同BottomNavigationView