How can I customize rate my app dialog of Zendesk. In sample app a style is added in style.xml file and it is working. But I don't know how to apply that style for Rating dialog. Please help me. Thanks in advance.
style.xml:
<!-- +++++++++++++++++++++++++++++++++ -->
<!-- Start rate my app dialogue styles -->
<!-- +++++++++++++++++++++++++++++++++ -->
<style name="rma_button">
<item name="android:background">#color/light_background</item>
<item name="android:gravity">center</item>
<item name="android:textSize">18sp</item>
<item name="android:layout_weight">1</item>
<item name="android:lineSpacingMultiplier">1.25</item>
</style>
<style name="rma_title" parent="rma_button">
<item name="android:textSize">22sp</item>
<item name="android:background">#android:color/white</item>
<item name="android:lineSpacingMultiplier">1.25</item>
</style>
<style name="rma_divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1px</item>
<item name="android:background">#color/divider</item>
</style>
<!-- +++++++++++++++++++++++++++++++ -->
<!-- End rate my app dialogue styles -->
<!-- +++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<!-- Start rate my app dialogue feedback styles -->
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<style name="rma_feedback_issue_cancel_button" parent="_rma_feedback_issue_cancel_button">
<item name="android:background">#drawable/white_gradient_btn</item>
<item name="android:textColor">#color/grey_text</item>
</style>
<!--
This style overrides the parent style to change the background colour of the button
depending on the state
-->
<style name="rma_feedback_issue_send_button" parent="_rma_feedback_issue_send_button">
<item name="android:layout_marginLeft">8dp</item>
<item name="android:background">#drawable/green_gray_btn_selector</item> <!-- Button colour will change -->
<item name="android:textColor">#color/green_gray_txt_selector</item>
</style>
<style name="rma_feedback_message_title" parent="_rma_feedback_message_title">
<item name="android:textColor">#color/grey_text</item>
</style>
<style name="rma_feedback_message_subtitle" parent="_rma_feedback_message_subtitle">
<item name="android:textColor">#color/grey_text</item>
<item name="android:lineSpacingMultiplier">1.25</item>
</style>
<!--
In this example we are overriding the parent style using a selector to control the colour
of the text differently whether the edittext is enabled or disabled.
-->
<style name="rma_feedback_issue_edittext" parent="_rma_feedback_issue_edittext">
<item name="android:textColor">#color/enabled_disabled_grey_selector</item>
<item name="android:textColorHint">#color/text_hint</item>
</style>
<style name="rma_feedback_divider" parent="_rma_feedback_divider">
<item name="android:background">#color/divider</item>
</style>
<style name="rma_feedback_progress" parent="_rma_feedback_progress">
<item name="android:indeterminateDrawable">#drawable/progress_green_small_holo</item>
</style>
<!-- ++++++++++++++++++++++++++++++++++++++++ -->
<!-- End rate my app dialogue feedback styles -->
<!-- ++++++++++++++++++++++++++++++++++++++++ -->
Issue resolved by creating a separate theme for the activity that is using RateMyApp dialog and applied styles for button, title and divider of dialog as below
<style name="CustomTheme" parent="Theme.AppCompat">
<item name="RateMyAppPaddingTop">#dimen/rma_padding_top</item>
<item name="RateMyAppPaddingBottom">#dimen/rma_padding_bottom</item>
<item name="RateMyAppButtonStyle">#style/rma_button_style</item>
<item name="RateMyAppTitleStyle">#style/rma_title_style</item>
<item name="RateMyAppDividerStyle">#style/rma_divider_style</item>
<item name="RateMyAppDividerHeight">#dimen/rma_divider_height</item>
</style>
<dimen name="rma_padding_top">24dp</dimen>
<dimen name="rma_padding_bottom">24dp</dimen>
<style name="rma_button_style">
<item name="android:background">#color/light_background</item>
<item name="android:gravity">center</item>
<item name="android:textSize">18sp</item>
<item name="android:layout_weight">1</item>
<item name="android:textColor">#color/black</item>
<item name="android:lineSpacingMultiplier">1.25</item>
</style>
<style name="rma_divider_style">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1px</item>
<item name="android:background">#color/divider</item>
</style>
<style name="rma_title_style" parent="rma_button">
<item name="android:textSize">22sp</item>
<item name="android:background">#android:color/white</item>
<item name="android:lineSpacingMultiplier">1.25</item>
<item name="android:textColor">#color/black</item>
</style>
Related
I try to set the title text on my DialogFragment but its not working as I expected. The only thing that works is if I in the onCreate() of the dialogFragment explicitly do like this:
setStyle(DialogFragment.STYLE_NORMAL, MyStyl...............);
and in that style I have set the
<item name="android:windowNoTitle">false</item>
But I have multiple themes that user can change to during run time so I do like this to set DialogFragment theme.
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:srcCompat="http://schemas.android.com/tools"
android:id="#+id/place_search_dialog"
style="?alertDialogTheme"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible">
But now the Title text is not showing even do I in the alertDialogTheme attribute have set the "android:windowNoTitle">false</item>,
why is this happening?
<resources >
<!-- Base Theme -->
<style name="BaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Attributes for all APIs -->
<item name="windowActionBar">true</item>
<item name="windowNoTitle">true</item>
<item name="dialogTheme">#style/AppTheme.Dialog</item>
<item name="alertDialogTheme">#style/AppTheme.Dialog.Alert</item>
<!-- Theme for the Preferences -->
<item name="preferenceTheme">#style/AppPreferenceTheme</item>
</style>
<!-- Default App Theme -->
<style name="AppTheme" parent="BaseTheme">
<!-- API specific attributes 14+ -->
<item name="selectableRectDrawable">#drawable/state_list_selectable_rect_black</item>
<item name="selectableRectDrawableInverse">#drawable/state_list_selectable_rect_white</item>
<item name="selectableRectDrawableColored">#drawable/state_list_selectable_rect_black</item>
<item name="selectableRoundedRectDrawable">#drawable/state_list_selectable_rounded_rect_black</item>
<item name="selectableRoundedRectDrawableInverse">#drawable/state_list_selectable_rounded_rect_white</item>
<item name="selectableRoundedRectDrawableColored">#drawable/state_list_selectable_rounded_rect_black</item>
</style>
<!-- Bohemia App Theme -->
<style name="BaseTheme.Bohemia" parent="AppTheme">
<!-- Attributes for all APIs -->
<item name="colorPrimary">#color/material_bohemia_400</item>
<item name="colorPrimaryDark">#color/material_bohemia_600</item>
<item name="colorAccent">#color/material_bohemia_a100</item>
<item name="dialogTheme">#style/AppTheme.Dialog.Bohemia</item>
<item name="alertDialogTheme">#style/AppTheme.Dialog.Alert.Bohemia</item>
<item name="android:windowBackground">#color/material_bohemia_300</item>
<item name="colorControlHighlight">#color/material_bohemia_a100</item>
<item name="colorControlActivated">#color/material_bohemia_a100</item>
<item name="colorControlNormal">#color/material_bohemia_a200</item>
</style>
<style name="AppTheme.Bohemia" parent="BaseTheme.Bohemia">
<!-- API specific attributes 14+ -->
<item name="selectableRectDrawableColored">#drawable/state_list_selectable_rect_bohemia</item>
<item name="selectableRoundedRectDrawableColored">#drawable/state_list_selectable_rounded_rect_bohemia</item>
</style>
<!-- Red App Theme -->
<style name="BaseTheme.Red" parent="AppTheme">
<!-- Attributes for all APIs -->
<item name="colorPrimary">#color/material_red_500</item>
<item name="colorPrimaryDark">#color/material_red_700</item>
<item name="colorAccent">#color/material_red_a700</item>
<item name="dialogTheme">#style/AppTheme.Dialog.Red</item>
<item name="alertDialogTheme">#style/AppTheme.Dialog.Alert.Red</item>
<item name="android:windowBackground">#color/material_red_300</item>
<item name="colorControlHighlight">#color/material_red_a200</item>
<item name="colorControlActivated">#color/material_red_a200</item>
<item name="colorControlNormal">#color/material_red_a200</item>
<!-- Chat color -->
</style>
<style name="AppTheme.Red" parent="BaseTheme.Red">
<!-- API specific attributes 14+ -->
<item name="selectableRectDrawableColored">#drawable/state_list_selectable_rect_red</item>
<item name="selectableRoundedRectDrawableColored">#drawable/state_list_selectable_rounded_rect_red</item>
</style>
<!-- Orange App Theme -->
<style name="BaseTheme.Orange" parent="AppTheme">
<!-- Attributes for all APIs -->
<item name="colorPrimary">#color/material_orange_500</item>
<item name="colorPrimaryDark">#color/material_orange_700</item>
<item name="colorAccent">#color/material_orange_a700</item>
<item name="dialogTheme">#style/AppTheme.Dialog.Orange</item>
<item name="alertDialogTheme">#style/AppTheme.Dialog.Alert.Orange</item>
<item name="android:windowBackground">#color/material_orange_300</item>
<item name="colorControlHighlight">#color/material_orange_a200</item>
<item name="colorControlActivated">#color/material_orange_a200</item>
<item name="colorControlNormal">#color/material_orange_a200</item>
</style>
<style name="AppTheme.Orange" parent="BaseTheme.Orange">
<!-- API specific attributes 14+ -->
<item name="selectableRectDrawableColored">#drawable/state_list_selectable_rect_orange</item>
<item name="selectableRoundedRectDrawableColored">#drawable/state_list_selectable_rounded_rect_orange</item>
</style>
<!-- Default Dialog Theme -->
<style name="AppTheme.Dialog" parent="Theme.AppCompat.Light.Dialog">
</style>
<!-- Bohemia Dialog Theme -->
<style name="AppTheme.Dialog.Bohemia">
<item name="colorPrimary">#color/material_bohemia_400</item>
<item name="colorPrimaryDark">#color/material_bohemia_500</item>
<item name="colorAccent">#color/material_bohemia_a100</item>
</style>
<!-- Red Dialog Theme -->
<style name="AppTheme.Dialog.Red">
<item name="colorPrimary">#color/material_red_500</item>
<item name="colorPrimaryDark">#color/material_red_700</item>
<item name="colorAccent">#color/material_red_a700</item>
</style>
<!-- Orange Dialog Theme -->
<style name="AppTheme.Dialog.Orange">
<item name="colorPrimary">#color/material_orange_500</item>
<item name="colorPrimaryDark">#color/material_orange_700</item>
<item name="colorAccent">#color/material_orange_a700</item>
</style>
<!-- Default Alert Dialog Theme -->
<style name="AppTheme.Dialog.Alert" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:windowNoTitle">false</item>
</style>
<!-- Bohemia Alert Dialog Theme -->
<style name="AppTheme.Dialog.Alert.Bohemia" >
<item name="colorPrimary">#color/material_bohemia_400</item>
<item name="colorPrimaryDark">#color/material_bohemia_500</item>
<item name="colorAccent">#color/material_bohemia_a100</item>
<item name="android:background">#color/material_bohemia_400</item>
<item name="android:textColor">#color/material_bohemia_a200</item>
</style>
<!-- Red Alert Dialog Theme -->
<style name="AppTheme.Dialog.Alert.Red">
<item name="colorPrimary">#color/material_red_500</item>
<item name="colorPrimaryDark">#color/material_red_700</item>
<item name="colorAccent">#color/material_red_a700</item>
<item name="android:background">#color/material_red_500</item>
</style>
<!-- Orange Alert Dialog Theme -->
<style name="AppTheme.Dialog.Alert.Orange">
<item name="colorPrimary">#color/material_orange_500</item>
<item name="colorPrimaryDark">#color/material_orange_700</item>
<item name="colorAccent">#color/material_orange_a700</item>
<item name="android:background">#color/material_orange_500</item>
</style>
</resources>
I ended up creating custom title and simply not call setTitle() on the dialog
I have tried for several days to fix a problem where multiple of my UI elements in my toolbar is the wrong color. If you take a look at the picture below you can see what I mean:
Elements that should be white are black and I just can't figure out how to fix this through my theme.
Here's my themes.xml (sry about the mess in there, but theming is really difficult):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.GuidelinesCompat.Light.DarkToolbar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowBackground">#color/colorBackground</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="toolbarStyle">#style/AppTheme.NoActionBar.ToolbarStyle</item>
<item name="actionModeStyle">#style/AppTheme.NoActionBar.ActionModeStyle</item>
<item name="searchViewStyle">#style/AppTheme.NoActionBar.SearchViewStyle</item>
<!--<item name="android:actionModeBackground">#color/bg_action_mode</item>-->
<!--<item name="android:textColorSecondary">#color/white</item>-->
</style>
<style name="AppTheme.ActionBar">
<item name="android:windowActionModeOverlay">true</item>
</style>
<!-- Base toolbar theme. -->
<style name="AppTheme.NoActionBar.ToolbarStyle" parent="Widget.GuidelinesCompat.Toolbar">
<item name="titleTextAppearance">#style/AppTheme.NoActionBar.ToolbarTitleTextAppearance</item>
</style>
<style name="AppTheme.NoActionBar.ToolbarTitleTextAppearance" parent="#style/TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textColor">#color/white</item>
<item name="android:textColorSecondary">#color/white</item>
</style>
<!-- Base Action Mode styles -->
<style name="AppTheme.NoActionBar.ActionModeStyle" parent="Widget.GuidelinesCompat.ActionMode">
<item name="background">#color/bg_action_mode</item>
<!--<item name="android:actionModeBackground">#color/bg_action_mode</item>-->
<!--<item name="android:actionOverflowButtonStyle">#style/ActionModeTitleTextStyle</item>-->
<!--<item name="statusBarColor">#color/grey_100</item>-->
</style>
<style name="ActionModeTitleTextStyle" parent="Widget.GuidelinesCompat.ActionButton.Overflow">
<item name="android:textColor">#color/white</item>
<item name="android:textColorSecondary">#color/white</item>
</style>
<style name="AppTheme.NoActionBar.SearchViewStyle" parent="Widget.AppCompat.SearchView">
<!-- Sets the search icon -->
<item name="searchIcon">#drawable/ic_search_white_24dp</item>
<!-- Gets rid of the "underline" in the text -->
<!--<item name="queryBackground">#color/white</item>-->
<!-- Gets rid of the search icon when the SearchView is expanded -->
<!--<item name="searchHintIcon">#null</item>-->
<!-- The hint text that appears when the user has not typed anything -->
<!--<item name="queryHint">#string/menu_examination_search_hint</item>-->
<item name="android:textAppearance">#style/SearchViewTextAppearance</item>
</style>
<style name="SearchViewTextAppearance">
<item name="android:textColorHint">#color/white</item>
<item name="android:textColor">#color/white</item>
<item name="android:textColorSecondary">#color/white</item>
</style>
<!-- Theme applied to LoginActivity and SignUpActivity -->
<style name="AppTheme.Login" parent="AppTheme.NoActionBar">
<item name="android:windowBackground">#color/colorPrimary</item>
<item name="android:textColorHint">#color/iron</item>
<item name="android:textColorPrimary">#color/white</item>
<item name="colorControlNormal">#color/iron</item>
<item name="colorControlActivated">#color/white</item>
<item name="colorControlHighlight">#color/white</item>
<item name="colorButtonNormal">#color/colorPrimaryDarker</item>
</style>
<style name="AppTheme.NavigationView">
<item name="android:textColorSecondary">#color/colorTextSecondary</item>
</style>
<!-- Theme applied to Textview in LoginActivity and SignUpActivity -->
<style name="WhiteText" parent="#android:style/TextAppearance">
<item name="android:textColor">#color/white</item>
</style>
<!-- Animations applied to dialog when entering or exiting -->
<style name="DialogAnimation">
<item name="android:windowEnterAnimation">#anim/slide_up</item>
<item name="android:windowExitAnimation">#anim/slide_down</item>
</style>
I've found out that if I set textColorSecondary in my AppTheme.NoActonBar all my controls are correctly coloured white, but this gives me trouble in all my dialogs, that now also have textColorSecondary set to white.
I hope someone out there can show me a solution, cause I'm out of ideas.
Try this here .
In your toolbar layout:
<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:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
app:theme="#style/ToolBarStyle"
app:popupTheme="#style/ToolBarPopupStyle"
android:background="#color/actionbar/>
In your styles:
<!-- ToolBar -->
<style name="ToolBarStyle" parent="Theme.AppCompat">
<item name="android:textColorPrimary">#android:color/white</item>
<item name="android:textColorSecondary">#android:color/white</item>
<item name="actionMenuTextColor">#android:color/white</item>
<item name="actionOverflowButtonStyle">#style/ActionButtonOverflowStyle</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
</style>
I got this styles for my Android app:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowBackground">#color/background_new</item>
<item name="android:textColorPrimary">#color/colorAccent</item>
<item name="android:textColorHint">#color/colorAccentHint</item>
<!-- Customize your theme here. -->
</style>
<style name="MyToolBar" parent="Widget.AppCompat.ActionBar">
<!-- Support library compatibility -->
<item name="android:textColorPrimary">#color/colorAccent</item>
<item name="android:textColorSecondary">#color/colorAccent</item>
<item name="colorControlNormal">#color/colorAccent</item>
</style>
<!-- Custom searchView may be used or not-->
<style name="SearchViewStyle" parent="Widget.AppCompat.SearchView">
<!-- Gets rid of the search icon -->
<item name="searchIcon">#null</item>
<!-- Gets rid of the "underline" in the text -->
<item name="queryBackground">#null</item>
<!-- Gets rid of the search icon when the SearchView is expanded -->
<item name="searchHintIcon">#null</item>
<!-- The hint text that appears when the user has not typed anything -->
<!--<item name="closeIcon">#null</item> -->
</style>
<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
<item name="tabTextAppearance">#style/MyCustomTabText</item>
</style>
<style name="MyCustomTabText" parent="TextAppearance.Design.Tab">
<item name="android:textSize">12sp</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="NavDrawerTextStyle" parent="Base.TextAppearance.AppCompat">
<item name="android:textSize">12sp</item>
</style>
<style name="MyCheckBox" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorControlNormal">#color/colorPrimaryTransparent</item>
<item name="colorControlActivated">#color/colorAccent</item>
</style>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textColorPrimary">#color/colorAccent</item>
<item name="android:background">#color/background1</item>
<item name="android:buttonStyle">#style/MyApp.BorderlessButton</item>
</style>
<style name="MyApp.BorderlessButton" parent="#style/Widget.AppCompat.Button.Borderless">
<item name="android:textSize">12sp</item>
</style>
<style name="MyRadioButton" parent="Theme.AppCompat.Light">
<item name="colorControlNormal">#color/colorAccent</item>
<item name="colorControlActivated">#color/colorAccent</item>
</style>
Normally i have transparent background on Toolbar of NavigationDrawler menu items click.
But sometimes theme in my app changes to Holo theme , and i can figure it out when its happens , so when i press menu items in Toolbar or in NavigationDrawler their background become blue, like in Holo theme
Where i have mistake and why its happens?
Can you publish your Android Manifest ? Maybe some activities override the base application style ?
I want to change the background color of the backbutton and overflowmenu button on pressed state.
I am using ActionBarActivity . Appcompact v7 library.
Programmatically is it possible to change background color of the back button and overflowmenubutton ?
Below is my styles:
<resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- <item name="windowActionBar">false</item> -->
</style>
<style name="ActionBar.Solid.Sri" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_sri</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_sri</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_sri</item>
<item name="progressBarStyle">#style/ProgressBar</item>
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionBarDivider">#color/action_bar_text_color</item>
<item name="actionBarDivider">#color/action_bar_text_color</item>
<item name="actionBarItemBackground">#drawable/selectable_background_sri</item>
<item name="android:actionBarStyle">#style/ActionBar.Transparent</item>
<item name="actionBarStyle">#style/ActionBar.Transparent</item>
<!--
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
-->
<item name="actionOverflowMenuStyle">#style/OverflowMenu</item>
<item name="popupMenuStyle">#style/PopupMenu</item>
<item name="dropDownListViewStyle">#style/DropDownListView</item>
<item name="android:popupMenuStyle">#style/PopupMenu</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView</item>
<item name="actionModeBackground">#drawable/cab_background_top_sri</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_sri</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode</item>
<!--
<item name="actionOverflowButtonStyle">#style/OverFlowStyle</item>
<item name="android:actionOverflowButtonStyle">#style/OverFlowStyle</item>
-->
<item name="actionDropDownStyle">#style/DropDownNav</item>
<item name="android:actionDropDownStyle">#style/DropDownNav</item>
<item name="android:actionBarTabTextStyle">#style/TabTextStyle</item>
<item name="actionBarTabTextStyle">#style/TabTextStyle</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<!-- <item name="actionBarStyle">#style/Theme.MyApp.ActionBar</item> -->
</style>
<style name="ActionButton.CloseMode" parent="#style/Widget.AppCompat.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_sri</item>
</style>
<style name="DropDownListView" parent="#style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_sri</item>
</style>
<style name="PopupMenu" parent="#style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_sri</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">#style/TitleTextStyle</item>
<!-- Support library compatibility -->
<item name="titleTextStyle">#style/TitleTextStyle</item>
</style>
<style name="ActionBar.Transparent" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="background">#drawable/ab_transparent_sri</item>
<item name="progressBarStyle">#style/ProgressBar</item>
<item name="android:titleTextStyle">#style/TitleTextStyle</item>
<!-- Support library compatibility -->
<item name="titleTextStyle">#style/TitleTextStyle</item>
</style>
<style name="ProgressBar" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_sri</item>
</style>
<style name="OverFlowStyle" parent="#style/Widget.AppCompat.Light.ActionButton.Overflow">
<item name="android:src">#drawable/ic_empty</item>
</style>
<style name="TitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/action_bar_text_color</item>
</style>
<style name="TabTextStyle" parent="#style/Widget.AppCompat.ActionBar.TabText">
<item name="android:textColor">#color/action_bar_text_color</item>
</style>
<style name="ActionBarTabStyle" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_sri</item>
<item name="background">#drawable/tab_indicator_ab_sri</item>
</style>
<style name="DropDownNav" parent="#style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_sri</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_sri</item>
<item name="android:dropDownSelector">#drawable/selectable_background_sri</item>
<item name="background">#drawable/spinner_background_ab_sri</item>
</style>
<!--
<style name="Theme.MyApp.ActionBar" parent="style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
remove shadow below action bar
<item name="android:elevation">0dp</item>
Support library compatibility
<item name="elevation">0dp</item>
<item name="android:windowContentOverlay">#null</item>
</style>
-->
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<!-- Required for Lollipop. -->
<!-- <item name="android:overlapAnchor">false</item> -->
</style>
<style name="ProgressBarStyle" parent="#android:style/Widget.ProgressBar.Horizontal" />
<!--
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:background">#drawable/actionbar_background</item>
<item name="android:windowActionBarOverlay">true</item>
Support library compatibility
<item name="background">#drawable/actionbar_background</item>
<item name="windowActionBarOverlay">true</item>
</style>
-->
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Sri.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu</item>
<item name="dropDownListViewStyle">#style/DropDownListView</item>
</style>
</resources>
Please help me. Thank you guys.
The Action Bar Style Generator is very useful, but it generates a lot of files, most of which are irrelevant if you only want to change the background colour please look at this:
https://stackoverflow.com/a/20077381/611258.
Although i strongly urge you to use the new toolbar or its support library equivalent.
I am having a problem preventing the status bar from taking on the primaryColor. I want to leave the status bar unstyled but on lollipop it is always taking on the color of the primaryColor defined in my styles.xml
Excerpt from styles:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" >
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme.TransparentActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<!-- Support library compatibility -->
<item name="windowActionBarOverlay">true</item>
<item name="android:windowBackground">#color/white</item>
</style>
<!-- START Market Themes -->
<style name="AppTheme.Blue" parent="AppTheme">
<item name="colorPrimary">#color/primaryColorBlue</item>
</style>
styles/v21
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" >
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme.TransparentActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#color/black</item>
<item name="android:windowActionBarOverlay">true</item>
<!-- Support library compatibility -->
<item name="windowActionBarOverlay">true</item>
<item name="android:windowBackground">#color/white</item>
<item name="android:windowContentTransitions">true</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#android:color/white</item>
</style>
<style name="ToolBarStyle" parent="">
<item name="android:elevation">#dimen/toolbar_elevation</item>
<item name="popupTheme">#style/ThemeOverlay.AppCompat.Light</item>
<item name="theme">#style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
You're telling it to be your primary colour.
The status bar gets its colour form your colorPrimaryDark so change
<item name="colorPrimaryDark">?attr/colorPrimary</item>
to
<item name="colorPrimary">?attr/colorPrimary</item>
<item name="colorPrimaryDark">#android:color/black</item>
I think this should only be necessary in your styles-v21 but I'm not close enough to anything to test it.
Docs here
<resources>
<!-- inherit from the material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">#color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">#color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">#color/accent</item>
</style>
</resources>