Use android:actionLayout
in menu item tag to specify custom lyout (icon with text).
Menu item will look like:
<item
android:id="@+id/edit_menu"
android:actionLayout="@layout/custom_edit_row"
android:orderInCategory="100"
android:title="@string/edit"
app:showAsAction="always"></item>
Edit
custom_edit_row.xml
will be:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
style="@android:style/Widget.ActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true">
<ImageView
android:id="@+id/imageViewEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/edit_ic" />
<TextView
android:id="@+id/tvEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Edit" />
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…