我只想将我的设计视为底部导航 View ,因此我通过设置 tools:showIn="bottom_navigation_view" 在 menu.xml 文件上尝试了以下操作,但它对我的设计 View 选项卡没有任何影响
我不想要的菜单 View 图像
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="bottom_navigation_view">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="@string/title_home" />
<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="@string/title_dashboard" />
<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/title_notifications" />
</menu>
所以请给我建议这样一个可行的 tools:showIn 值。
最佳答案
将此添加到您的布局并替换菜单的值。
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
android:theme="@style/AppTheme"
app:menu="@menu/navigation"
android:layout_gravity="start"
android:id="@+id/navigation"
/>
关于android - 如何更改底部导航 Activity 的菜单布局文件的设计选项卡 View (工具 :showIn),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54127794/