They don't make it easy and previous methods like the following do not work.
<item android:id="@+id/action_settings2"
android:title="@string/action_settings2"
android:icon=@drawable/your_image"/>
I had to add a menu type image through Android Studio (See screen shots) and use the following menu XML:
<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.s33me.hamsandwich.BaseMenu"
android:layout_height="match_parent" android:layout_width="match_parent">
<item
android:id="@+id/action_more"
android:title=""
>
<item android:id="@+id/item1"
android:icon="@drawable/ic_action_search"
app:showAsAction="always"
android:title="Search"
/>
<item android:id="@+id/item4"
android:icon="@drawable/ic_action_mail"
app:showAsAction="always"
android:title="Export"
/>
<item android:id="@+id/item2"
android:icon="@drawable/ic_action_home"
app:showAsAction="ifRoom"
android:title="Home"/>
<item android:id="@+id/item3"
android:icon="@drawable/ic_action_exit"
app:showAsAction="ifRoom"
android:title="Exit"
/>
</item>
</menu>
This looks like this (ugly and inconsistent):
No comments:
Post a Comment