xml - 找不到与给定名称匹配的资源(在“菜单”中,值为“@menu/bottomnavigationmain”)
问题描述
我正在尝试进行按钮导航,并且正在关注本教程。https://blog.xamarin.com/exploring-androids-bottom-navigation-view/。这是我在 axml 文件中的代码: file: ly_homescreen.axml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@color/colorPrimaryDark"
android:minWidth="25px"
android:minHeight="25px"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linearLayout1">
<ImageView
android:src="@drawable/logo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_margin="5dp"
android:id="@+id/imageView1" />
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_navigation" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="start"
android:layout_alignParentBottom="true"
android:background="@android:color/white"
app:elevation="16dp"
app:menu="@menu/bottomnavigationmain" />
</LinearLayout>
</RelativeLayout>
这是我在bottomnavigationmain.xml
文件中的代码,位于projectname>menu>bottomnavigationmain.xml
. 我收到了我在标题中提到的错误。任何帮助表示赞赏。
如果这很重要,我会在bottomnavigationmain.xml
文件中收到错误消息:
@(Content) build action is not supported.
解决方案
打开bottomnavigationmain.xml的属性,将BuildAction从Content改为AndroidResource
推荐阅读
- java - 如何使 3 个 imageButtons 响应?
- reactjs - 使用 Selenium Webdriver 获取 React 道具
- javascript - 合并运算符仅发出列表中第一个可观察对象的结果
- cassandra - 查询 Cassandra 的最快方法是什么?主键还是分区键?
- nginx - Nginx:如果找不到静态文件,请在网络服务器上尝试相同的 URL
- flutter - {@tool snippet} 无法正常工作
- ios - 音频在基于 IONIC 的 IOS 应用程序中运行非常缓慢
- javascript - 如何将 useState 钩子传递给功能组件中的子道具
- macos - SCNRenderer 快照并不总是应用抗锯齿
- java - 如何停止索引 Maven“目标”自动生成的文件夹?