【发布时间】:2016-01-23 12:41:00
【问题描述】:
这是我的工具栏
<?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 及以上。
【问题讨论】:
-
如果我将 xml 中的 popupTheme="@style/ToolbarStylepopuptheme" 更改为 app:popupTheme="@style/ToolbarStylepopuptheme" 文本颜色会改变但背景没有改变
-
与 'app:' 一起使用并将父级分配给与上述样式相同的样式 'ToolbarStylepopuptheme'