java - Whenever I try to add a button to my actionbar, the items are added under the overflow menu -


i trying add simple button action bar, when try use following code, items added items under overflow menu, not on actionbar itself. appreciated,

jacob

here java:

@override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu items use in action bar     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.menu_review, menu);       return super.oncreateoptionsmenu(menu); } @override public boolean onoptionsitemselected(menuitem item) {     // handle presses on action bar items     switch (item.getitemid()) {         case android.r.id.home:              super.onbackpressed();             return true;            default:             return super.onoptionsitemselected(item);      } } 

and xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:yourapp="http://schemas.android.com/apk/res-auto">       <item android:id="@+id/seda"         android:icon="@drawable/redpinreal"         android:title="hello worldh"         android:showasaction="withtext|always"/>  </menu>     

i have enabled:

getsupportactionbar().setdisplayhomeasupenabled(true); 

part of code (android:showasaction, instead of yourapp:showasaction) attempting use native action bar. part of code (getsupportactionbar(), instead of getactionbar()) attempting use appcompat-v7 action bar backport. choose one , stick it.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -