找不到与给定名称匹配的资源(在“菜单”中,值为“ @ menu / bottomnavigationmain”)

时间:2018-06-30 18:03:33

标签: xml visual-studio xamarin visual-studio-2015 xamarin.android

我正在尝试进行波顿导航,并且正在关注本教程。 https://blog.xamarin.com/exploring-androids-bottom-navigation-view/。这是我在axml文件中的代码: 文件: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.

1 个答案:

答案 0 :(得分:2)

打开bottomnavigationmain.xml的属性,将BuildAction从Content更改为AndroidResource