android - 底部导航 View 与 RecyclerView 的最后一项重叠

标签 android android-recyclerview overlap bottomnavigationview

RecyclerView 的最后一项被 BottomNavigationView 覆盖。描述和时间被 BottomNavigationView 重叠。

framgment_news.xml:这包含我的 RecyclerView

<android.support.constraint.ConstraintLayout ...
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragments.NewsFragment"
android:background="#fff">

<ImageView
    android:id="@+id/imageView" ... />

<TextView
    android:id="@+id/textView" ... />

<TextView
    android:id="@+id/textView3" ... />

<TextView
    android:id="@+id/textView2" ... />

<com.mikhaellopez.circularimageview.CircularImageView
    android:id="@+id/circularImageView" ... />

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="12dp"
    app:layout_constraintTop_toBottomOf="@+id/textView3"
    tools:layout_editor_absoluteX="0dp"
    android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>

activity_home.xml

<android.support.constraint.ConstraintLayout ...
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".HomeActivity">

    <FrameLayout
        android:id="@+id/frameContainer"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginStart="0dp"
        android:layout_marginTop="0dp"
        android:layout_marginEnd="0dp"
        app:layout_constraintBottom_toTopOf="@+id/view"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        android:layout_above="@+id/bottom_navigation_view"
        app:layout_constraintTop_toTopOf="parent" />

    <!--Border on Top of Bottom Navigation View-->
    <View
        android:id="@+id/view"
        android:layout_width="match_parent"
        android:layout_height="0.5dp"
        android:background="#616161"
        app:layout_constraintBottom_toTopOf="@+id/bottom_navigation_view" />

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#fff"
        app:labelVisibilityMode="unlabeled"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:menu="@menu/bottom_navigation_menu" />

</android.support.constraint.ConstraintLayout>

The last item of RecyclerView being overlapped by BottomNavigationView

最佳答案

给RecyclerView的父布局添加padding

<android.support.constraint.ConstraintLayout ...
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="56dp"
    tools:context=".Fragments.NewsFragment"
    android:background="#fff">

并根据Material Design改变BottomNavigationView的高度

<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation_view"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:background="#fff"
    app:labelVisibilityMode="unlabeled"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:menu="@menu/bottom_navigation_menu" />

关于android - 底部导航 View 与 RecyclerView 的最后一项重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55184363/

相关文章:

java - 如何将 RecyclerView 添加到 View

html - 重叠粘性标题的问题(重叠其下方的主要内容)

algorithm - 查找字符串重叠的有效算法

Android:致命异常:AdWorker #1 java.lang.NoSuchMethodError:java.io.IOException.<init>

android - 即使文件大小非常小,也会出现 TransactionTooLargeException

javascript - Cordova 应用寻找未知的 favicon.ico

xamarin - RecyclerView点击事件

java - 回收器 View : Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference

Android:更改文本时保留按钮大小

c - 检测两个字符串之间的重叠长度