Android ActionBar appears after clicking settings -


code:

@override public boolean oncreateoptionsmenu(menu menu) {     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.start_activity_actions, menu);     return super.oncreateoptionsmenu(menu); } 

start_activity.actions.xml:

<item     android:id="@+id/action_search"     android:icon="@drawable/ic_action_search"     android:title="@string/action_search"     android:showasaction="always"     />  <item     android:id="@+id/action_collection"     android:title="@string/action_collection"     android:icon="@drawable/ic_action_collection"     android:showasaction="always"     /> 

my menu appears after clicking settings button. it's not visibile on launch. how change ?

if have extend activity android.app.activity; menu xml have should work.

if using support library android.support.v7.app.actionbaractivity display action menus in action bar, change menu xml below..

<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto">  <item     android:id="@+id/action_search"     android:icon="@drawable/ic_action_search"     android:title="@string/action_search"     custom:showasaction="always"/>  <item     android:id="@+id/action_collection"     android:title="@string/action_collection"     android:icon="@drawable/ic_action_collection"     custom:showasaction="always"/> </menu> 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -