Android: icons not showing in action bar

I am following google guide for action bars but no icons appear on it, this is the menu xml file:

<menu   xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
    <item android:id="@+id/action_refresh"
          android:icon="@drawable/ic_action_refresh"
          android:title="refresh"
          android:showAsAction="ifRoom"/>
    <item android:id="@+id/action_settings"
          android:icon="@drawable/ic_action_settings"
          android:title="settings"
          android:showAsAction="ifRoom"/>
     <item android:id="@+id/action_compose"
          android:icon="@drawable/ic_action_new"
          android:title="add"
          android:showAsAction="ifRoom"/>
</menu>

      

and this is in my main activity:

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu items for use in the action bar
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main_activity_bar, menu);
        return super.onCreateOptionsMenu(menu);
    }

      

+3


source to share


1 answer


Use yourapp:showAsAction

instead of android:showAsAction


AND make sure your Activity

extends ActionBarActivity

from lib mapping



+4


source







All Articles