【问题标题】:I have RecyclerView and Bottom app bar but it doesn't show bottom app bar我有 RecyclerView 和底部应用栏,但它不显示底部应用栏
【发布时间】:2020-05-12 04:15:59
【问题描述】:

我有 RecyclerView 和底部应用栏,但它没有显示底部应用栏。我应该在我的代码中添加什么?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <include
        android:id="@+id/include"
        layout="@layout/appbar"/>
    <androidx.recyclerview.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/recycler"/>
    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:menu="@menu/bottom_app_bar">
    </com.google.android.material.bottomnavigation.BottomNavigationView>
</LinearLayout>

【问题讨论】:

  • 请分享截图。
  • 尝试给BottomNavigationView一个宽度和高度,看看它是否显示

标签: android android-recyclerview android-bottomappbar


【解决方案1】:

试试这个:

<androidx.recyclerview.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/recycler"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-06
    • 1970-01-01
    • 1970-01-01
    • 2018-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多