Tôi đang sử dụng thanh công cụ cho android. Tôi chỉ muốn thay đổi màu nền của menu mục bổ sung. Nhưng nó không thay đổi.Màu nền menu tùy chọn Thanh công cụ
Phong cách xml
<style name="MyDarkToolbarStyle" parent="Widget.AppCompat.Toolbar">
<item name="popupTheme">@style/PopupMenuStyle</item>
<item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
<style name="PopupMenuStyle" parent="android:Widget.Holo.Light.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
</style>
XML Toolbar
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ColorPrimary"
android:elevation="2dp"
android:theme="@style/MyDarkToolbarStyle" />
Thiết kế này được thiết kế kém. Cảm ơn .. – milosmns
Tôi nghĩ rằng thuộc tính popupTheme chỉ hoạt động trên API 21 và lên – CapitanNerd
Điều này không hiệu quả đối với tôi, nhưng [this] (https://stackoverflow.com/questions/26554996/change-toolbar-color-in- appcompat-21) đã làm. – Android