我正在尝试将appcompat-v7工具栏设置为我的溢出菜单的不同背景颜色.我尝试使用我的应用程序的主题和我的工具栏的样式,但我无法实现它.
这是我的工具栏:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:layout_width="match_parent"
app:theme="@style/AppToolbarTheme"
android:layout_height="wrap_content">
Run Code Online (Sandbox Code Playgroud)
这是我创建的风格:
<style name="AppToolbarTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/cian</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我的主题是扩展Theme.AppCompat.Light.
有谁知道我该怎么做?如果不可能使用样式有没有其他方法来实现它?