Daniel Juric Daniel Juric - 1 month ago 9
Android Question

Android - Multiple Menus in Toolbar

I added a menu to my

toolbar
, but I don't know how to add multiple menus.

main_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">

<item android:title="Share"
android:id="@+id/main_menu_item_share"></item>
<item android:title="About"
android:id="@+id/main_menu_item_about" />
</menu>

Answer

do it like this it will show 3 menus on toolbar

try like below

<item android:id="@+id/common_menu_settings"
    android:icon="@drawable/settings"
    android:title="@string/settings"
    app:showAsAction="always" />

<item android:id="@+id/common_menu_settings1"
    android:icon="@drawable/settings"
    android:title="@string/settings"
    app:showAsAction="always" />

<item android:id="@+id/common_menu_settings2"
    android:icon="@drawable/settings"
    android:title="@string/settings"
    app:showAsAction="always" />

....
Comments