簡體   English   中英

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"

出現錯誤“在包中找不到屬性的資源標識符”

我正在閱讀這里已經回答的一些問題,但仍然無法解決錯誤,也許是因為我使用的是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

更改此:

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

對此:

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

並建立

問題是我正在使用:

<android.support.v4.widget.DrawerLayout> 

代替:

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

現在我的代碼可以工作了。

您是否在控件頂部添加了app:名稱空間?

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM