我无法在动作模式中了解如何修复Toolbar
的样式。
<!-- DialogWhenLarge uses to show Activity as Dialog on the tablet -->
<style name="Theme.Paper.DialogWhenLarge" parent="Theme.AppCompat.Light.DialogWhenLarge">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/Theme.Paper.Toolbar</item>
<item name="actionBarPopupTheme">@style/Theme.Paper.Toolbar.PopupOverlay</item>
<!-- Below attributes available on the v11+ only -->
<item name="android:windowCloseOnTouchOutside">false</item>
</style>
<style name="Theme.Paper.Toolbar" parent="Theme.Paper">
<item name="android:background">@color/primary</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="colorControlNormal">@color/white</item>
<item name="colorControlHighlight">@color/accent</item>
<item name="colorControlActivated">@color/white</item>
<item name="actionMenuTextColor">@color/white</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="Theme.Paper.Toolbar.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="android:textColorPrimary">@color/black_87</item>
<item name="android:textColorSecondary">@color/black_54</item>
<item name="android:colorBackground">@color/white</item>
<item name="colorControlHighlight">@color/black_30</item>
<item name="colorControlActivated">@color/white</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
我的问题是什么?我想得到什么?我在下面发布了它。
正确的工具栏样式是我需要的
但在动作模式下看起来如此(白色动作和带有原色背景和白色文字的菜单)
附:我试图解决它,但每次我的样式都不对。
答案 0 :(得分:0)
我不确定......但也许有人会遇到同样的问题。所以在适合我的解决方案之下:
<resources>
<!--
*
* App themes
*
-->
<!-- DialogWhenLarge uses to show Activity as Dialog on the tablet -->
<style name="Theme.Paper.DialogWhenLarge" parent="Theme.AppCompat.Light.DialogWhenLarge">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionBarPopupTheme">@style/Theme.Paper.Toolbar.PopupOverlay</item>
<item name="actionModeStyle">@style/Theme.Paper.ActionMode</item>
<!-- Below attributes available on the v11+ only -->
<item name="android:windowCloseOnTouchOutside">false</item>
</style>
<!--
*
* ActionBar, AppBarLayout and Toolbar styles
*
-->
<!-- Action mode -->
<style name="Theme.Paper.ActionMode" parent="Widget.AppCompat.ActionMode">
<item name="background">@color/primary</item>
</style>
<!-- Toolbar -->
<style name="Theme.Paper.Toolbar" parent="Theme.Paper">
<item name="android:background">@color/primary</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="colorControlNormal">@color/white</item>
<item name="colorControlHighlight">@color/accent</item>
<item name="colorControlActivated">@color/white</item>
<item name="actionMenuTextColor">@color/white</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<!-- Toolbar popup overlay -->
<style name="Theme.Paper.Toolbar.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="android:textColorPrimary">@color/black_87</item>
<item name="android:textColorSecondary">@color/black_54</item>
<item name="android:colorBackground">@color/white</item>
<item name="colorControlHighlight">@color/black_30</item>
<item name="colorControlActivated">@color/white</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
</resources>