I am trying to draw a white navigation bar with black button on splash (Theme.Paper.Launcher) and after change a background color to #color/primary_dark (Theme.Paper):
style-v27:
<resources>
<!-- Basic paper theme -->
<style name="Theme.Paper" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary</item>
<item name="colorAccent">#color/accent</item>
<item name="windowNoTitle">true</item>
<item name="actionModeStyle">#style/Widget.Paper.ActionMode</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeCloseDrawable">#drawable/ic_close_white_24dp</item>
<item name="actionMenuTextColor">#color/white</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:navigationBarColor">#color/primary_dark</item>
<item name="android:windowLightNavigationBar">false</item>
</style>
<!-- Splash theme. -->
<style name="Theme.Paper.Launcher" parent="Theme.Paper">
<item name="colorPrimary">#android:color/white</item>
<item name="colorPrimaryDark">#android:color/white</item>
<item name="android:windowBackground">#drawable/bg_splash</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">#android:color/white</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
</resources>
But my navigation bar is still black with white buttons. What am I doing wrongly?
P.S. There is Android Oreo on my phone...
Related
I can't get how to fix styles for my Toolbar in the action mode.
<!-- 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>
What is my problem in? And what do I want to get? I posted it below.
Correct toolbar style is as I need
But in action mode it looks so (white actions and a menu with primary color background and white text)
P.S. I tried to fix it but each time I get wrong styles.
I don't sure... but maybe a someone will have the same problem. So below the solution that works for me:
<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>
I want to change the width of menu with ToolBar .Here is my code.but it not working
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/blue_dark</item>
<item name="colorPrimaryDark">#color/blue_dark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="actionOverflowMenuStyle">#style/OverflowMenu</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:textSize">11dp</item>
<item name="android:textColorSecondary">#ffffff</item>
<item name="android:dropDownWidth">70dp</item>
<item name="android:dropDownHeight">190dp</item>
</style>
I have searched how to change the icon color but i have no success on it.
this is my style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionBarDivider">#android:color/transparent</item>
<item name="android:actionBarTabBarStyle">#style/AppTheme.TabBar</item>
<item name="actionBarTabBarStyle">#style/AppTheme.TabBar</item>
<item name="colorPrimary">#color/main_organization_base_color_1</item>
<item name="colorPrimaryDark">#color/main_organization_color</item>
<item name="colorAccent">#color/main_organization_base_color_2</item>
<item name="android:textColorPrimary">#color/text_color_primary</item>
<item name="android:textColorSecondary">#color/palette_flat_asphalt_3</item>
<item name="android:colorBackground">#color/default_bg_color</item>
<item name="android:windowBackground">#color/default_bg_color</item>
<item name="android:textColorPrimaryInverse">#color/text_color_primary_inverse</item>
<item name="colorControlNormal">#color/color_control_normal</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar.Solid">
<item name="titleTextStyle">#style/MyTitleTextStyle</item>
<item name="background">#color/action_background_color</item>
</style>
<style name="MyTitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
But icon keeps appearing in black color when none of those colors are black or dark. (just colorPrimaryDark is dark blue)
I want to change the text color and the navigation icon color in the toolbar
Change the text color of the action item "13311"
And also of the drawer icon.
The styles
//activity theme
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#color/ColorPrimary</item>
<item name="colorPrimaryDark">#color/ColorPrimaryDark</item>
<item name="android:textColorPrimary">#color/white</item>
<item name="switchStyle">#style/Switch</item>
</style>
//theme for switch widget
<style name="Switch" parent="Widget.AppCompat.CompoundButton.Switch">
<item name="android:thumb">#drawable/switch_selector</item>
<item name="showText">false</item>
</style>
//toolbar theme
<style name="MyDarkToolbarStyle" parent="Widget.AppCompat.Toolbar">
<item name="android:gravity">center_vertical</item>
<!--<item name="popupTheme">#style/PopupMenuStyle</item>-->
<item name="actionButtonStyle">#style/MyActionButtonStyle</item>
</style>
//overflow menu theme
<style name="PopupMenuStyle" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">#color/black</item>
<item name="android:gravity">left|center</item>
<item name="android:background">#color/white</item>
</style>
//action button theme
<style name="MyActionButtonStyle" parent="AppBaseTheme">
<item name="android:minWidth">0dip</item>
<item name="android:textSize">14sp</item>
<item name="android:paddingLeft">0dip</item>
<item name="android:paddingRight">0dip</item>
<item name="android:actionMenuTextColor">#color/white</item>
</style>
<style name="MyDarkToolbarStyle" parent="ThemeOverlay.AppCompat.ActionBar">
<!-- text color for action menu icons -->
<item name="android:textColorSecondary">#fff</item>
<!-- overflow menu icon color -->
<item name="actionMenuTextColor">#fff</item>
</style>
Edit
To change the navigation drawer color use
<style name="DrawerStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#color/drawer_color</item>
</style>
change the parent theme to darkactionbar
when the action bar is dark you will get your icon and text white , when it is light you will get them black .
that's all
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
To change arrow color I used colorControlNormal
from AppTheme and AppTheme.ActionBarTheme
<style name="AppBaseTheme" parent="#style/Theme.AppCompat.Light">
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:textColorPrimary">#android:color/white</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:windowTranslucentStatus" tools:targetApi="21">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="windowActionBar">false</item>
<!-- Toolbar Theme / Apply white arrow -->
<item name="colorControlNormal">#android:color/white</item>
<item name="actionBarTheme">#style/AppTheme.ActionBarTheme</item>
<item name="android:itemTextAppearance">#style/ToolbarTextAppearance</item>
<!-- Material Theme -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/accent_color</item>
<item name="android:statusBarColor" tools:targetApi="21">#color/statusBarColor</item>
<item name="android:navigationBarColor" tools:targetApi="21">#color/navigationBarColor</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="21">true</item>
</style>
<style name="AppTheme.ActionBarTheme" parent="#style/ThemeOverlay.AppCompat.ActionBar">
<!-- White arrow -->
<item name="colorControlNormal">#android:color/white</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#color/drawerArrowColor</item>
</style>
<style name="ToolbarTextAppearance">
<item name="android:textColor">#android:color/white</item>
</style>
I have a custom theme for my appcompat action bar, however the action icons (back icon and overflow menu buttons) are black but I am using the android:icon="#android:drawable/stat_sys_upload" and the background for this is staying white and I want this to be black.
Below is my theme code;
<style name="Theme.Alcontrol" parent="#style/Theme.AppCompat.Light">
<item name="actionBarItemBackground">#drawable/selectable_background_alcontrol</item>
<item name="popupMenuStyle">#style/PopupMenu.Alcontrol</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Alcontrol</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Alcontrol</item>
<item name="actionDropDownStyle">#style/DropDownNav.Alcontrol</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Alcontrol</item>
<item name="actionModeBackground">#drawable/cab_background_top_alcontrol</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_alcontrol</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Alcontrol</item>
</style>
<style name="ActionBar.Solid.Alcontrol" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_alcontrol</item>
<item name="backgroundStacked">#color/white</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_alcontrol</item>
<item name="progressBarStyle">#style/ProgressBar.Alcontrol</item>
</style>
<style name="ActionBar.Transparent.Alcontrol" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="background">#drawable/ab_transparent_alcontrol</item>
<item name="progressBarStyle">#style/ProgressBar.Alcontrol</item>
</style>
<style name="PopupMenu.Alcontrol" parent="#style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_alcontrol</item>
</style>
<style name="DropDownListView.Alcontrol" parent="#style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_alcontrol</item>
</style>
<style name="ActionBarTabStyle.Alcontrol" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_alcontrol</item>
</style>
<style name="DropDownNav.Alcontrol" parent="#style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_alcontrol</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_alcontrol</item>
<item name="android:dropDownSelector">#drawable/selectable_background_alcontrol</item>
</style>
<style name="ProgressBar.Alcontrol" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_alcontrol</item>
</style>
<style name="ActionButton.CloseMode.Alcontrol" parent="#style/Widget.AppCompat.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_alcontrol</item>
</style>