我的主主题基于Theme.AppCompat.Light
如下:
<style name="core" parent="Theme.AppCompat.Light" >
<!-- Material, Yo!-->
<item name="colorPrimary">@color/theme_main_color</item>
<item name="colorPrimaryDark">@color/deep_purple</item>
<item name="colorAccent">@color/theme_accent_color</item>
<item name="android:navigationBarColor" tools:ignore="NewApi">?attr/colorPrimary</item>
<!-- Toolbar -->
<item name="theme">@style/my_toolbar_theme</item>
<item name="drawerArrowStyle">@style/my_drawer_arrow</item>
<!-- Actionbar -->
<item name="android:actionBarDivider">@null</item>
<item name="android:actionBarTabStyle">@null</item>
<item name="android:actionBarTabBarStyle">@null</item>
<!-- Contextual Actionbar -->
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?attr/colorAccent</item>
<item name="actionModeStyle">@style/my_actionmode_style</item>
</style>
<style name="my_drawer_arrow" parent="Widget.AppCompat.DrawerArrowToggle" >
<item name="spinBars">true</item>
<item name="color">@color/theme_accent_color</item>
</style>
<style name="my_toolbar_style">
<item name="android:id">@id/toolbar</item>
<item name="android:minHeight">?attr/actionBarSize</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item>
<item name="android:background">?attr/colorPrimary</item>
<item name="android:elevation" tools:ignore="NewApi">5dp</item>
</style>
<style name="my_actionmode_style" parent="Widget.AppCompat.Light.ActionMode.Inverse" >
<item name="titleTextStyle">@style/my_actionmode_title_style</item>
<item name="subtitleTextStyle">@style/my_actionmode_subtitle_style</item>
</style>
<style name="my_toolbar_style.gradient">
<item name="android:background">@drawable/ab_gradient_bg</item>
</style>
<style name="my_toolbar_theme" parent="ThemeOverlay.AppCompat.Dark.ActionBar" >
<!-- Customize the toolbar here -->
</style>
<style name="my_actionmode_title_style" parent="TextAppearance.AppCompat.Widget.ActionMode.Title">
<item name="android:textColor">@color/std_white</item>
</style>
<style name="my_actionmode_subtitle_style" parent="TextAppearance.AppCompat.Widget.ActionMode.Subtitle">
<item name="android:textColor">@android:color/white</item>
</style>
在 actionmode 中,我希望看到带有白色后退箭头的白色标题/副标题。我已经能够将标题和副标题文本颜色设置为白色,但后退箭头仍然是黑色。此问题仅出现在我使用 SupportActionbar 而不是工具栏的地方(工具栏中的后退箭头为白色)。
这是我在 ActionMode 中的工具栏。
这是 ActionMode 中的 actionbar。相同的手机、相同的应用、相同的主题,只是不同的 Activity 。
我在主题中找不到任何可以决定这种颜色的东西。根据消息来源,图标是 @drawable/abc_ic_ab_back_mtrl_am_alpha
,它是白色的,所以一定是有什么东西在给它着色。这种偏黑的颜色从何而来?
最佳答案
要使用 AppCompat 自定义它:
在您的应用级主题中:
<style name="MyTheme" parent="Theme.AppCompat.Light">
<item name="actionModeCloseButtonStyle">@style/myclosebutton</item>
</style>
在 CloseButtonStyle 中:
<style name="myclosebutton" parent="Widget.AppCompat.Light.ActionButton.CloseMode">
<item name="android:tint">#ff0</item> <!-- whatever color -->
</style>
关于android - 使用 appcompat-v7 在 Actionmode 中自定义 'back' 箭头颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28353285/