我正在尝试更改我的ActionMode的背景和文本颜色。我正在使用API 11和AppCompat。带AppCompat的ActionMode无法更改背景和文本颜色
我试过了下面的style.xml,但ActionMode背景总是白色,文字颜色是黑色的。 我想将文本颜色更改为白色和背景颜色为蓝色。
我该如何解决这个问题?
这里是我的style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- ActionMode -->
<item name="actionModeStyle">@style/MyActionModeStyle</item>
</style>
<!-- Setup the style of the ActionMode here -->
<style name="MyActionModeStyle" parent="@style/Widget.AppCompat.ActionMode">
<item name="android:background">@color/blue</item>
<item name="background">@color/blue</item>
<item name="android:titleTextStyle">@style/MyActionModeTitle</item>
<item name="titleTextStyle">@style/MyActionModeTitle</item>
</style>
<!-- Setup the text style of the ActionMode here -->
<style name="MyActionModeTitle" parent="@style/TextAppearance.AppCompat.Widget.ActionMode.Title">
<item name="android:textColor">#ffffff</item>
</style>
</resources>
在我的活动我使用android.support.v7.app.ActionBarActivity但我用工具栏: 这是我settings_activity_toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<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"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:navigationContentDescription="@string/abc_action_bar_up_description"
android:background="?attr/colorPrimary"
app:navigationIcon="?attr/homeAsUpIndicator"
app:title="@string/action_settings" />
你尝试了一个'- @ color/primary
'? –
也发布你的活动代码。我想我已找到解决方法 –
哪种解决方法? – Tobi