Create an ActionBar menu and options in the same activity

I'm trying to show the same menu options in both the ActionBar and the menu options, but it only appears in one of them, is there an easy way to do this?

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.app.MainActivity" >

<!-- Search, should appear as action button -->
<item android:id="@+id/action_search"
    android:icon="@drawable/ic_action_search"
    android:title="@string/action_search"
    app:showAsAction="always"/>

    <item android:id="@+id/action_settings"
        android:title="@string/action_settings"
        android:orderInCategory="100"
        app:showAsAction="always"/>

</menu>

Items are now displayed in the action bar. Changing the application: showAsAction for android: app: showAsAction only displays menu items in the options menu to make them visible in both menus?

thank

+3
source share
1 answer

Change showAsAction="always"to the showAsAction="never"one for which you want to display in the options menu below ...

See the showAsActionlink below for more details .

http://developer.android.com/guide/topics/resources/menu-resource.html

0
source

All Articles