Skip to content Skip to sidebar Skip to footer

Menu Items Won't Show Up In The Actiobar

UPDATE: It works on the tab, but on the phone it's overlayed for some reason I have a question regarding the menu items android uses for the ActionBar, I have a custom background f

Solution 1:

I think you need to fix this:

@OverridepublicbooleanonCreateOptionsMenu(Menu menu) {
    MenuInflaterinflater= getMenuInflater();
    Log.i("hallo", "hoi");
    inflater.inflate(R.layout.product_menu, menu);  //  <- this is wrongreturntrue;
}

Instead of R.layout.product_menu, it should refer to R.menu.your_desired_menu

Solution 2:

If you want to show your menu item in the action bar, set the android:showAsAction property of your item in product_menu.xml;

<?xml version="1.0" encoding="utf-8"?><menuxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:id="@+id/item1"android:title="Save"android:showAsAction="always" /></menu>

You can set this property to:

  • ifRoom
  • never
  • withText
  • always
  • collapseActionView

I hope this helps you!

Steffen

Post a Comment for "Menu Items Won't Show Up In The Actiobar"