Take the 2-minute tour ×

I have an application, and need to add some buttons on the ActionBar. To add these buttons, I created a xml file called menu_action_bar. The code is:


    android:title="Item 1"

    android:title="Item 2"

    android:title="Item 3"

    android:title="Item 4"

For this to have an effect in my application, I am rewriting the onCreateOptionsMenu method (Menu); The code was:

public boolean onCreateOptionsMenu(Menu menu) {


    getMenuInflater().inflate(R.menu.menu_action_bar, menu);
    return true;

However, when starting my application, my action bar is the same way, without any alteration, as with the Icon and the application name. I tried changing the theme of the application to see if it had had any effect, but my project only lets me use the Theme.AppCompat.Light, may be the cause of the problem?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I answered a question similar to this about 1-2 months back. See this -> http://stackoverflow.com/a/22780579/2801779 and also see the comments below my answer. Your concepts about AppCompat and v7 will be cleared. Look for HipHopDroid's (my) answer

share|improve this answer
Not works man! ;/ –  user1792343 May 28 at 17:47
Is your activity an ActionBarActivity or just an Activity? –  HipHopDroid May 29 at 5:01

try addign this to the menu tag:

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

and this to your items:

share|improve this answer

Your Answer


