我试图在我的Android应用程序中实现选项卡样式菜单栏,但是我添加到菜单中的任何<item />
未在预览中显示(请参阅下图)。Android项目不在菜单中出现
预览菜单/ menu_navigation.xml的:
(包含在菜单中的<item />
/未显示menu_navigation.xml)
菜单/ menu_navigation.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item
android:id="@+id/bMenu"
android:title="@string/app_name"
android:icon="@drawable/ic_home"
app:showAsAction="ifRoom"
/>
activity_main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:design="http://schemas.android.com/apk/res-auto"
tools:context="com.engineeringeric.parkerapp.MainActivity">
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
design:menu="@menu/menu_navigation">
</android.support.design.widget.BottomNavigationView>
请张贴您的代码供我们分析。谢谢。 – statosdotcom
你好,没有为所描述的UI元素编写的Java代码,因为我不相信只需要Java来设计/显示标签UI。上面提供了我正在使用的所有xml。谢谢。 –
在您的预览窗口中,模拟手机为什么选中“无操作栏?”。也许这......因为它迫使使用没有酒吧的风格......并且你想要显示生活在标签栏中的标签...... – statosdotcom