简体   繁体   中英

Main.xml Error About Library

I'm trying use Navigation Drawer. Everything is okay, but there is an error here:

<menu
    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"
    tools:context=".MainActivity"
    >

    <item
        android:id="@+id/action_example"
        android:orderInCategory="100"
        android:title="@string/action_example"
        android:showAsAction="ifRoom"
        />
    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        android:showAsAction="ifRoom"
        />
</menu>

Red underlined (two)line is:

android:showAsAction="ifRoom"

Information message is here

And This line is grayed.

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

Any help can be help!

change this line

android:showAsAction="ifRoom"

to

app:showAsAction="ifRoom"

And Clean Build your Project.You are done.Hope it will help.Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM