Search code examples
android-actionbarandroid-support-libraryandroid-2.2-froyoandroid-actionbar-compat

ActionBar Compat show as action attribute missing


Can't Use

android:showAsAction="ifRoom" 

in the menu XML despite I'm using the library support v7 as jar file

note: minimum SDK is 8


Solution

  • Problem:


    The referenced android attribute is not available. You need to use a custom namespace to explicitly reference the v7 implementation.

    My solution:


    <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto">
    
        <item
            ...
            app:showAsAction="always"
            ...
        />
    
    </menu>