ydnas
ydnas

Reputation: 519

Need to Hide Menu Button in Action Bar Android

I am trying to customize my action bar in android. I have created a custom layout like this:

<TextView 
    android:id="@+id/actionBarTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Sample"/>    
<ImageView 
    android:id="@+id/actionBarImageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/some_image"/>

and my code is:

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

    // Do any other config to the action bar
    getActionBar().setDisplayShowTitleEnabled(false);
    getActionBar().setDisplayShowHomeEnabled(false);
    getActionBar().setDisplayHomeAsUpEnabled(false);
    getActionBar().setCustomView(R.layout.custom_action_bar_layout);

I am able to see my custom layout in the action bar but along with that I get the menu icon at the extreme right of the action bar. I dont know how to remove or hide it.Pls help me out.

Upvotes: 0

Views: 7494

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006664

I get the menu icon at the extreme right of the action bar

Either:

  • You have defined items to appear in the overflow area, in which case, get rid of those, or

  • Your android:targetSdkVersion is under 11, in which case, raise it

See: Say Goodbye to the Menu Button.

Upvotes: 5

Related Questions