Xamarin android 未在包中找到属性的资源标识符
Xamarin android No resource identifier found for attribute in package
我目前正在使用 xamarin 开发 android 核心应用程序,我已经安装了 android 支持设计 23.4.0.1 和 Android.Support.v7.AppCompat 23.4。 0.1
我现在遇到的问题是:
app:headerLayout="@layout/nav_header"
app:menu="@layout/menu_navigation"
有错误"No resource identifier found for attribute in package"
我正在阅读这里已经回答的一些问题,但仍然无法修复错误,可能是因为我使用的是 xamarin,我不知道。
有问题的完整代码:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.learn2crack.myapplication.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
<include
layout="@layout/listitem_device" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header"
app:menu="@layout/menu_navigation"/>
</android.support.v4.widget.DrawerLayout>
注意:我使用的是本教程:https://www.learn2crack.com/2016/03/android-material-design-sliding-navigation-drawer.html
您是否在控件顶部添加了 app:
命名空间?
xmlns:app="http://schemas.android.com/apk/res-auto"
问题是我使用的是:
<android.support.v4.widget.DrawerLayout>
而不是:
</android.support.v7.widget.DrawerLayout>
现在我的代码可以工作了。
改变这个:
xmlns:app|xmlns:local="http://schemas.android.com/apk/res-auto"
为此:
xmlns:app|xmlns:local="http://schemas.android.com/apk/lib/com.app.chasebank"
并构建
我目前正在使用 xamarin 开发 android 核心应用程序,我已经安装了 android 支持设计 23.4.0.1 和 Android.Support.v7.AppCompat 23.4。 0.1
我现在遇到的问题是:
app:headerLayout="@layout/nav_header"
app:menu="@layout/menu_navigation"
有错误"No resource identifier found for attribute in package"
我正在阅读这里已经回答的一些问题,但仍然无法修复错误,可能是因为我使用的是 xamarin,我不知道。
有问题的完整代码:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.learn2crack.myapplication.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
<include
layout="@layout/listitem_device" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header"
app:menu="@layout/menu_navigation"/>
</android.support.v4.widget.DrawerLayout>
注意:我使用的是本教程:https://www.learn2crack.com/2016/03/android-material-design-sliding-navigation-drawer.html
您是否在控件顶部添加了 app:
命名空间?
xmlns:app="http://schemas.android.com/apk/res-auto"
问题是我使用的是:
<android.support.v4.widget.DrawerLayout>
而不是:
</android.support.v7.widget.DrawerLayout>
现在我的代码可以工作了。
改变这个:
xmlns:app|xmlns:local="http://schemas.android.com/apk/res-auto"
为此:
xmlns:app|xmlns:local="http://schemas.android.com/apk/lib/com.app.chasebank"
并构建