![](/img/trans.png)
[英]How to change title text and buttons color WITHOUT changing action overflow menu text color in new Toolbar?
[英]changing overflow menu toolbar text and background color
這是我的工具欄
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ToolbarTheme"
popupTheme="@style/ToolbarStylepopuptheme" />
和我的style.xml
<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">@color/colorPrimary</item>
<item name="android:textColorPrimary">#ffffff</item>
<item name="actionMenuTextColor">#ffffff</item>
</style>
<style name="ToolbarStylepopuptheme" >
<item name="android:colorBackground">@android:color/darker_gray</item>
<item name="android:textColor">#ffff55</item>
</style>
我已經在互聯網上查了很多,似乎沒有什么對我有用。 我的應用支持API級別16及更高級別。
嘗試使用:
<item name="android:popupBackground">@android:color/white</item>
或者,添加: parent="@android:style/Widget.PopupMenu"
並嘗試使用您的代碼。
最后:
<style name="ToolbarStylepopuptheme" parent="@android:style/Widget.PopupMenu">
我忘了說,我的壞! 將此( app )添加到工具欄 :
app:popupTheme="@style/ToolbarStylepopuptheme"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.