[英]Can I show icon in overflow menu of Android Toolbar?
請注意我正在引用工具欄小部件(Android L / API 21+)通過溢出菜單和圖標我的意思是這樣的:
更難的是:有沒有任何方式圖標出現在文本的右側?
在菜單中創建菜單,例如:main_activity_actions.xml並將此代碼用於工具欄,嘗試:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:All4One="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/algo"//some id
android:icon="@drawable/kami_nomi_zu_shiru_sekai3" //add the image
android:title="nose"
All4One:showAsAction="always">
<menu>
<item android:id="@+id/WIFI"//option to display on the menu
android:icon="@drawable/nisekoi1"//this is a option of the submenu
android:title="@string/WIFI"/>
<item android:id="@+id/DATOS"
android:icon="@drawable/nisekoi6" //this one also is a option
android:title="@string/DATOS"/>
<item android:id="@+id/BT"
android:icon="@drawable/sao1"
android:title="@string/BT"/>
<item android:id="@+id/NADA"
android:icon="@drawable/nisekoi6" //the same
android:title="@string/NADA"/>
</menu>
</item>
</menu>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.