[英]Android: how to replace the three dots in the TOOLBAR menu (not the action bar)
如何用圖像替換出現在工具欄中的三個點。
那有可能嗎?
您看到的“三個點”稱為“溢出圖標”,它是android.support.v7.widget.Toolbar
的可配置部分。
在Java中,調用:
Drawable d = /* your drawable here */;
toolbar.setOverflowIcon(d);
此處的文檔: https : //developer.android.com/reference/android/support/v7/widget/Toolbar.html#setOverflowIcon(android.graphics.drawable.Drawable)
我已經用我的應用程序的速率應用程序圖標替換了3個點。 像這樣更改main_menu.xml中的項目
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="schemas.android.com/tools"
tools:context=".MainActivity"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/rateapp_bn"
android:title="Rate App"
android:icon="@drawable/ic_stars_black_24dp"
android:orderInCategory="100"
app:showAsAction="always|withText"/>
</menu>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.