【问题标题】:Xamarin android No resource identifier found for attribute in packageXamarin android没有为包中的属性找到资源标识符
【发布时间】:2018-05-15 21:13:59
【问题描述】:

我目前正在使用 xamarin 开发一个 android 核心应用程序,我已经安装了 android support design 23.4.0.1 和 Android.Support.v7.AppCompat 23.4.0.1

我现在遇到的问题是:

    app:headerLayout="@layout/nav_header"
    app:menu="@layout/menu_navigation"

出现错误“未找到包中属性的资源标识符”

我正在阅读这里已经回答的一些问题,但仍然无法修复错误,可能是因为我使用的是 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

【问题讨论】:

    标签: android xamarin drawer


    【解决方案1】:

    改变这个:

    xmlns:app|xmlns:local="http://schemas.android.com/apk/res-auto"
    

    至此:

    xmlns:app|xmlns:local="http://schemas.android.com/apk/lib/com.app.chasebank"
    

    并构建

    【讨论】:

      【解决方案2】:

      问题是我使用的是:

      <android.support.v4.widget.DrawerLayout> 
      

      代替:

      </android.support.v7.widget.DrawerLayout> 
      

      现在我的代码可以工作了。

      【讨论】:

        【解决方案3】:

        您是否在控件顶部添加了 app: 命名空间?

        xmlns:app="http://schemas.android.com/apk/res-auto"

        【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-07-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多