android - 无法从 apk/res-auto 命名空间访问项目资源

标签 android xamarin namespaces resources visual-studio-2017

我在这里遇到了几个对我来说毫无意义的错误:

这是代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/DrawerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<!-- The main content view -->
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <android.support.design.widget.AppBarLayout
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:id="@+id/ToolbarLayout">
            <include
                android:id="@+id/Toolbar" android:layout="@layout/Toolbar"/><!-- AVAILABLE HERE --><!-- app:layout_scrollFlags="scroll|enterAlways"-->
        </android.support.design.widget.AppBarLayout>
        <FrameLayout
            android:id="@+id/ContentFrame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/ToolbarLayout"/>
    </RelativeLayout>
    <android.support.design.widget.NavigationView
        android:id="@+id/NavView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent" 
        app:headerLayout="@layout/Toolbar"
        app:menu="@menu/Toolbar" />       <!-- NOT AVAILABLE HERE -->
        <!--app:headerLayout="@layout/NavHeader"
        app:menu="@menu/NavMenu"
          android:layout_gravity="start"-->
</android.support.v4.widget.DrawerLayout>

这是错误列表:

Errors
正如您所看到的,工具栏清楚地存在,因为它在包含标记中被引用,但是在使用应用程序命名空间的两个属性中不可用。

有人知道这是怎么回事吗?

最佳答案

资源名称中不能有大写字母。所以在这种情况下,我需要将 Toolbar.axml 更改为 toolbar.axml

在 xamarins 票务系统中找到的资源 https://bugzilla.xamarin.com/show_bug.cgi?id=36821

关于android - 无法从 apk/res-auto 命名空间访问项目资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45515754/

相关文章:

android - 如何在ActionBar 上制作一个动画图标?

java - 让开关设置预定义警报

Xamarin Forms 应用架构

android - 在适用于 Android 的 Xamarin.Forms 上使用 Google map

c++ - 命名空间中定义的类中的友元函数

javascript - 从不同的命名空间加入命名空间房间

android - 在当前运行的 Activity 上添加一个具有新布局的新对话框,而不更改当前运行的 Activity 的布局文件

android - 如何在android中获取连接的蓝牙设备数据?

android - Xamarin:检索项目 CardView 的父级时出错

xml - 我可以忽略来自@XmlRootElement 的 child 的命名空间吗