android - 底部导航 View 不显示图标或标题

标签 android android-studio bottomnavigationview

我正在制作一个底部导航栏中包含三个项目的应用程序。我尝试实现它。代码看起来不错,没有错误,只是不会显示图标或标签。我查看了其他类似的问题,但没有一个有我正在寻找的答案。

我正在使用 android studio 3.3

这是我的底部导航 View :

<RelativeLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  xmlns:app="http://schemas.android.com/apk/res-auto">

  <android.support.design.widget.BottomNavigationView
     android:layout_width="match_parent"
     android:layout_height="56dp"
     android:layout_alignParentStart="true"
     android:layout_alignParentBottom="true"
     app:menu="@menu/nav_items" />

nav_items 文件

<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
    android:icon="@drawable/outline_home_black_18dp"
    android:title="@string/nav_home" />
<item
    android:icon="@drawable/outline_home_black_18dp"
    android:title="@string/nav_search" />
<item
    android:icon="@drawable/outline_home_black_18dp"
    android:title="@string/nav_account" />
</menu>

最佳答案

尝试使用这个:

<android.support.design.widget.BottomNavigationView
 android:layout_width="match_parent"
 android:layout_height="56dp"
 android:layout_alignParentStart="true"
 android:layout_alignParentBottom="true"
 app:menu="@menu/nav_items" 
 app:labelVisibilityMode="labeled"/>

关于android - 底部导航 View 不显示图标或标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54493477/

相关文章:

android - GoogleSignIn.getLastSignedInAccount() 在发布版本上返回 null

android - Android Studio离线添加 `Android plugin for Gradle`

java - 错误: No resource found that matches the given name (at 'src' with value '@drawable/black_title' )

android - Android 基于跟踪和基于采样的方法分析之间的差异及其对报告的 CPU 时间的影响

android-studio - 为什么在Kotlin中得到警告提示 “Simplify boolean expression”?

android - 如何使用代码更改 BottomNavigationView 的选定选项卡?

java - 如何使用 ImageView 而不是菜单项制作底部导航栏?

android - 如何在android中删除底部导航 View 的图标动画

android GMP 交叉编译

android - 以编程方式设置 ScrollView 的布局参数时出现异常