im using Material IO and i want to Change the Text-Color of my Menu.
<resources>
...
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
...
<item name="android:textColorPrimary">#color/colorText</item>
</style>
...
<resources>
Does exactly that. But it changes every Text Color. But i just want to Change the Color of my Menu-Text.
So i tried to change only that:
<style name="ActionBarTheme" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:textColor">#color/colorMenuText</item> //android.view
<item name="android:textColorPrimary">#color/colorMenuText</item>
<item name="android:actionMenuTextAppearance">#color/colorWhite</item>
<item name="android:background">#color/colorAccent</item>
<item name="popupTheme">#style/ActionBarPopupTheme</item>
<!-- backward compatibility -->
<item name="background">#color/colorAccent</item>
</style>
by writing some Thing like This.
I can change the Menu-Background this way, but i cant change the Menu-Text-Color this way. I tried everything i found on Stackoverflow but i couldnt fix this issue.
Whole Styles.xml
<resources>
<style name="ActionBarTheme" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:textColor">#color/colorMenuText</item> //android.view
<item name="android:textColorPrimary">#color/colorMenuText</item>
<item name="android:actionMenuTextAppearance">#color/colorWhite</item>
<item name="android:background">#color/colorAccent</item>
<item name="popupTheme">#style/ActionBarPopupTheme</item>
<!-- backward compatibility -->
<item name="background">#color/colorAccent</item>
</style>
<style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:colorAccent">#0000FF</item>
</style>
<style name="ActionBarPopupTheme">
<item name="android:textColor">#color/colorMenuText</item>
<item name="android:background">#color/colorMenuBackground</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
<!-- MENU -->
<item name="android:actionBarStyle">#style/ActionBarTheme</item>
<item name="actionBarStyle">#style/ActionBarTheme</item>
<!-- DIALOG -->
<item name="md_color_title">#color/colorPrimary</item>
<item name="md_color_content">#color/colorPrimaryDark</item>
<item name="md_color_button_text">#color/colorAccent</item>
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorTest2</item>
<item name="colorPrimaryDark">#color/colorTest3</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:actionMenuTextColor">#color/colorMenuText</item>
<item name="android:textColor">#color/colorWhite</item>
<item name="color">#color/colorTest4</item>
<item name="colorSecondary">#FF0000</item>
<item name="android:colorBackground">#color/colorBackground</item>
<item name="colorError">#color/colorError</item>
<item name="colorPrimaryVariant">#color/colorAccent</item>
<item name="colorSecondaryVariant">#color/colorTest</item>
<item name="colorSurface">#313131</item>
<item name="colorOnPrimary">#00BCD4</item>
<item name="colorOnSecondary">#00BCD4</item>
<item name="colorOnBackground">#673AB7</item>
<item name="colorOnError">#2196F3</item>
<item name="colorOnSurface">#color/colorOnAccent</item> <!-- placeholder farbe -->
<item name="scrimBackground">#E607FF</item>
<item name="android:editTextColor">#color/colorText</item>
<item name="android:textColorPrimary">#color/colorText</item>
<item name="android:textColorSecondary">#color/colorText</item>
<item name="android:textColorTertiary">#color/colorText</item>
<item name="android:textColorPrimaryInverse">#color/colorText</item>
<item name="android:textColorSecondaryInverse">#color/colorText</item>
<item name="android:textColorTertiaryInverse">#color/colorText</item>
</style>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyTheme.ActionBarStyle</item>
</style>
<style name="MyTheme.ActionBarStyle" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/colorMenuText</item>
</style>
<style name="Theme.MyApp" parent="Theme.AppCompat">
<!-- DIALOG -->
<item name="md_color_title">#color/colorPrimary</item>
<item name="md_color_content">#color/colorPrimaryDark</item>
<item name="md_color_button_text">#color/colorAccent</item>
<!-- Original AppCompat attributes. -->
<item name="colorPrimary">#color/colorTest4</item>
<item name="colorSecondary">#color/colorTest5</item>
<item name="android:colorBackground">#color/colorBackground</item>
<item name="colorError">#color/colorError</item>
<!-- New MaterialComponents attributes. -->
<item name="colorPrimaryVariant">#color/colorAccent</item>
<item name="colorSecondaryVariant">#color/colorTest</item>
<item name="colorSurface">#313131</item>
<item name="colorOnPrimary">#9C27B0</item>
<item name="colorOnSecondary">#00BCD4</item>
<item name="colorOnBackground">#673AB7</item>
<item name="colorOnError">#2196F3</item>
<item name="colorOnSurface">#E91E63</item>
<item name="scrimBackground">#FFC107</item>
<item name="textAppearanceHeadline1">#style/TextAppearance.MaterialComponents.Headline1</item>
<item name="textAppearanceHeadline2">#style/TextAppearance.MaterialComponents.Headline2</item>
<item name="textAppearanceHeadline3">#style/TextAppearance.MaterialComponents.Headline3</item>
<item name="textAppearanceHeadline4">#style/TextAppearance.MaterialComponents.Headline4</item>
<item name="textAppearanceHeadline5">#style/TextAppearance.MaterialComponents.Headline5</item>
<item name="textAppearanceHeadline6">#style/TextAppearance.MaterialComponents.Headline6</item>
<item name="textAppearanceSubtitle1">#style/TextAppearance.MaterialComponents.Subtitle1</item>
<item name="textAppearanceSubtitle2">#style/TextAppearance.MaterialComponents.Subtitle2</item>
<item name="textAppearanceBody1">#style/TextAppearance.MaterialComponents.Body1</item>
<item name="textAppearanceBody2">#style/TextAppearance.MaterialComponents.Body2</item>
<item name="textAppearanceCaption">#style/TextAppearance.MaterialComponents.Caption</item>
<item name="textAppearanceButton">#style/TextAppearance.MaterialComponents.Button</item>
<item name="textAppearanceOverline">#style/TextAppearance.MaterialComponents.Overline</item>
</style>
</resources>
I tried this minimum sample of your code and it gives me the desired behavior
I think there is a conflict with your styles
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="actionBarTheme">#style/ActionBarTheme</item>
</style>
<style name="ActionBarTheme" parent="#style/ThemeOverlay.MaterialComponents.ActionBar">
<item name="android:textColorPrimary">#ffffff</item>//for title text color
<item name="colorPrimary">#D81B60</item>// for toolbar background
<item name="popupTheme">#style/ActionBarPopupTheme</item>
</style>
<style name="ActionBarPopupTheme">
<item name="android:textColor">#304FFE</item> // for option menu text color
</style>
Related
i am trying to change the design of an existing app with a new design given by client, the app is none but Q-Municate from Quickblox, the exisitng design is old and using ActionBar, i want to replace everything with the latest Material Design, Adding AppCompact v7 Lib 23,causes affect and errors to some other libraries , so i am using AppCompact v7 19
A Good tutorial or step by step guideline would be appreciated. Thanks in advance
I am pasting my styles.xml
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionModeStyle">#style/MyActionMode</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="android:Widget.ActionBar">
<item name="android:background">#color/action_bar_background_color</item>
<item name="android:displayOptions">showTitle</item>
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
<item name="android:indeterminateProgressStyle">#style/IndeterminateProgressStyle</item>
</style>
<!-- ActionBar title body -->
<style name="MyActionBarTitleText" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
<style name="AppTheme.NoActionBar" parent="android:Theme.Holo.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
</style>
<style name="MyActionMode">
<item name="android:actionModeCloseDrawable">#drawable/badge_action_mode</item>
<item name="android:actionModeBackground">#drawable/badge_action_mode</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:titleTextStyle">#style/MyActionModeTitleText</item>
</style>
<style name="MyActionModeTitleText" parent="android:TextAppearance.Holo.Widget.ActionMode.Title">
<item name="android:textColor">#color/white</item>
</style>
<style name="baseToggleBtn">
<item name="android:textOff"></item>
<item name="android:textOn"></item>
</style>
<!-- EmojiTabs styles -->
<style name="EmojiTabImageButton" parent="android:Widget.ImageButton">
<item name="android:background">#drawable/tab_emoji_selector</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_weight">1</item>
</style>
<!-- Avatars ImageView style -->
<style name="AvatarImageView">
<item name="android:layout_width">#dimen/image_view_big_avatar_layout_width</item>
<item name="android:layout_height">#dimen/image_view_big_avatar_layout_height</item>
<item name="android:layout_gravity">center|top</item>
<item name="android:scaleType">centerCrop</item>
<item name="android:src">#drawable/placeholder_user</item>
</style>
<style name="IndeterminateProgressStyle" parent="#android:style/Widget.ProgressBar">
<item name="android:minHeight">24dp</item>
<item name="android:maxHeight">24dp</item>
<item name="android:minWidth">32dp</item>
<item name="android:maxWidth">32dp</item>
</style>
<style name="DoneCancelBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">#dimen/action_bar_height</item>
<item name="android:orientation">horizontal</item>
<item name="android:divider">#drawable/ic_action_divider</item>
<item name="android:showDividers" tools:ignore="NewApi">middle</item>
<item name="android:dividerPadding" tools:ignore="NewApi">12dp</item>
<item name="android:background">#color/action_button_bar</item>
</style>
<style name="ActionButton">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_weight">1</item>
<item name="android:background">#drawable/action_selectable_background</item>
</style>
<style name="ActionButtonText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_vertical</item>
<item name="android:paddingRight">20dp</item>
<!-- Offsets left drawable -->
<item name="android:drawablePadding">8dp</item>
<item name="android:textColor">#color/action_button_text</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">13sp</item>
</style>
<style name="ActionButtonText.Done">
<item name="android:drawableLeft">#drawable/ic_action_done</item>
<item name="android:text">#string/dlg_done</item>
</style>
<style name="ActionButtonText.Cancel">
<item name="android:drawableLeft">#drawable/ic_action_cancel</item>
<item name="android:text">#string/dlg_cancel</item>
</style>
On the previsualicer of the mobile phone, you can choose the theme here and choose material (dark or light)
I have a problem with my holo theme, it works right until Android 4.4 but when i run the same app in Android 5.0+ the dropdown menu for overflow items in the actionbar show the TEXT in color Black, i need the color WHITE
ANY IDEAS?
<style name="Theme.Flux" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_flux</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Flux</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Flux</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Flux</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Flux</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Flux</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_flux</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_flux</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Flux</item>
<!-- Light.DarkActionBar specific -->
<item name="android:actionBarWidgetTheme">#style/Theme.Flux.Widget</item>
<item name="android:actionMenuTextColor">#android:color/white</item>
<item name="actionMenuTextColor">#android:color/white</item>
</style>
<style name="ActionBar.Solid.Flux" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/ab_solid_flux</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_flux</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_flux</item>
<item name="android:progressBarStyle">#style/ProgressBar.Flux</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:actionMenuTextColor">#android:color/white</item>
<item name="actionMenuTextColor">#android:color/white</item>
<item name="android:titleTextStyle">#style/TitleColor</item>
</style>
<style name="TitleColor" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#android:color/white</item>
</style>
<style name="ActionBar.Transparent.Flux" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#drawable/ab_transparent_flux</item>
<item name="android:progressBarStyle">#style/ProgressBar.Flux</item>
</style>
<style name="PopupMenu.Flux" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_flux</item>
</style>
<style name="DropDownListView.Flux" parent="#android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_flux</item>
</style>
<style name="ActionBarTabStyle.Flux" parent="#android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_flux</item>
</style>
<style name="DropDownNav.Flux" parent="#android:style/Widget.Holo.Spinner">
<item name="android:background">#drawable/spinner_background_ab_flux</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_flux</item>
<item name="android:dropDownSelector">#drawable/selectable_background_flux</item>
</style>
<style name="ProgressBar.Flux" parent="#android:style/Widget.Holo.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_flux</item>
</style>
<style name="ActionButton.CloseMode.Flux" parent="#android:style/Widget.Holo.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_flux</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Flux.Widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu.Flux</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Flux</item>
</style>
<style name="menu_labels_style">
<item name="android:background">#drawable/fab_label_background</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:actionMenuTextColor">#android:color/white</item>
</style>
Change the style file also in values-v11 and values-v14 folders
i solve my problem when i put my style file in values-v11 and values-v14 folders i also add this style to my main style.
<item name="android:itemTextAppearance">#style/TextAppearance</item>
this is my style
<style name="Theme.Flux" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_flux</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Flux</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Flux</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Flux</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Flux</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Flux</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_flux</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_flux</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Flux</item>
<!-- Light.DarkActionBar specific -->
<item name="android:actionBarWidgetTheme">#style/Theme.Flux.Widget</item>
<item name="android:itemTextAppearance">#style/TextAppearance</item>
<item name="android:actionMenuTextColor">#android:color/white</item>
</style>
<style name="TextAppearance">
<item name="android:textColor">#android:color/white</item>
</style>
In my android application the text color of a sub menu item is displayed different on Android 4 (API level <=20) than Android 5.
Android 4
Android 5
My theme looks like the following:
<style name="Theme.Mytheme" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_mytheme</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Mytheme</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Mytheme</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Mytheme</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Mytheme</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_mytheme</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_mytheme</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Mytheme</item>
<item name="android:windowBackground">#drawable/app_background</item>
<item name="android:actionMenuTextColor">#android:color/white</item>
<!-- Light.DarkActionBar specific -->
<item name="android:actionBarWidgetTheme">#style/Theme.Mytheme.Widget</item>
<!-- Widget styles -->
<item name="android:editTextBackground">#drawable/mytheme_edit_text_holo_light</item>
<item name="android:textColorHighlight">#993e74b4</item>
<item name="android:textSelectHandleLeft">#drawable/mytheme_text_select_handle_left</item>
<item name="android:textSelectHandleRight">#drawable/mytheme_text_select_handle_right</item>
<item name="android:textSelectHandle">#drawable/mytheme_text_select_handle_middle</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/mytheme_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">#drawable/mytheme_btn_radio_holo_light</item>
<item name="android:buttonStyle">#style/ButtonMytheme</item>
<item name="android:imageButtonStyle">#style/ImageButtonMytheme</item>
<item name="android:dropDownSpinnerStyle">#style/SpinnerMytheme</item>
<item name="android:progressBarStyleHorizontal">#style/ProgressBarMytheme</item>
<item name="android:listChoiceBackgroundIndicator">#drawable/mytheme_list_selector_holo_light</item>
<item name="android:activatedBackgroundIndicator">#drawable/mytheme_activated_background_holo_light</item>
</style>
<style name="ActionBar.Solid.Mytheme" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/ab_solid_mytheme</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_mytheme</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_mytheme</item>
<item name="android:progressBarStyle">#style/ProgressBar.Mytheme</item>
</style>
<style name="ActionBar.Transparent.Mytheme" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#drawable/ab_transparent_mytheme</item>
<item name="android:progressBarStyle">#style/ProgressBar.Mytheme</item>
</style>
<style name="PopupMenu.Mytheme" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_mytheme</item>
</style>
<style name="DropDownListView.Mytheme" parent="#android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_mytheme</item>
<item name="android:textColor">#android:color/white</item>
</style>
<style name="ActionBarTabStyle.Mytheme" parent="#android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_mytheme</item>
</style>
<style name="DropDownNav.Mytheme" parent="#android:style/Widget.Holo.Spinner">
<item name="android:background">#drawable/spinner_background_ab_mytheme</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_mytheme</item>
<item name="android:dropDownSelector">#drawable/selectable_background_mytheme</item>
</style>
<style name="ProgressBar.Mytheme" parent="#android:style/Widget.Holo.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_mytheme</item>
</style>
<style name="ActionButton.CloseMode.Mytheme" parent="#android:style/Widget.Holo.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_mytheme</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Mytheme.Widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu.Mytheme</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Mytheme</item>
</style>
What has changed from Android 4 to Android 5 ? What should I add on my theme/style so that I can achieve the same text color on both versions ?
I have so style for alert dialogs:
<style name="Theme.Paper" parent="Theme.AppCompat.Light.NoActionBar">
<!-- customize the color palette -->
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="colorAccent">#color/accent</item>
<item name="android:alertDialogStyle">#style/Theme.Paper.AlertDialogStyle</item>
<item name="android:alertDialogTheme">#style/Theme.Paper.AlertDialog</item>
</style>
<style name="Theme.Paper.Toolbar" parent="Theme.Paper">
<item name="android:textColorPrimary">#color/white</item>
<item name="android:textColorSecondary">#color/white</item>
</style>
<style name="Theme.Paper.AlertDialogStyle" parent="android:Theme.Black">
<item name="android:fullDark">#color/white</item>
<item name="android:topDark">#color/white</item>
<item name="android:centerDark">#color/white</item>
<item name="android:bottomDark">#color/white</item>
<item name="android:fullBright">#color/white</item>
<item name="android:centerBright">#color/white</item>
<item name="android:bottomBright">#color/white</item>
<item name="android:bottomMedium">#color/white</item>
<item name="android:centerMedium">#color/white</item>
</style>
<style name="Theme.Paper.AlertDialog.Title">
<item name="android:maxLines">2</item>
<item name="android:scrollHorizontally">true</item>
</style>
<style name="Theme.Paper.AlertDialog.TextAppearanceMedium">
<!-- Set text size and color of message here -->
<item name="android:textSize">16sp</item>
<item name="android:textColor">#color/black_54</item>
</style>
<style name="Theme.Paper.AlertDialog.TextAppearanceLarge">
<!-- Set text size and color of title -->
<item name="android:textSize">20sp</item>
<item name="android:textColor">#color/black_87</item>
</style>
<style name="Theme.Paper.AlertDialog" parent="android:Theme.Black">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowTitleStyle">#style/Theme.Paper.AlertDialog.Title</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowMinWidthMajor">#android:dimen/dialog_min_width_major</item>
<item name="android:windowMinWidthMinor">#android:dimen/dialog_min_width_minor</item>
<item name="android:windowIsFloating">true</item>
<item name="android:textAppearanceMedium">#style/Theme.Paper.AlertDialog.TextAppearanceMedium</item>
<item name="android:textAppearanceLarge">#style/Theme.Paper.AlertDialog.TextAppearanceLarge</item>
<item name="android:buttonBarStyle">#style/Theme.Paper.AlertDialog.ButtonBar</item>
<item name="android:buttonBarButtonStyle">#style/Theme.Paper.FlatButton</item>
</style>
<style name="Theme.Paper.FlatButton">
<!-- Set background drawable and text size of the buttons here -->
<item name="android:background">#drawable/bg_dialog_button</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">#color/primary</item>
<item name="android:layout_height">36dp</item>
<item name="android:maxHeight">36dp</item>
<item name="android:minHeight">36dp</item>
<item name="android:minWidth">64dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_marginRight">4dp</item>
</style>
<style name="Theme.Paper.AlertDialog.ButtonBar">
<!-- Define a background for the button bar and a divider between the buttons here -->
<item name="android:divider">#android:color/transparent</item>
<item name="android:dividerPadding">0dp</item>
<item name="android:showDividers">none</item>
<item name="android:background">#color/white</item>
<item name="android:layout_height">48dp</item>
<item name="android:gravity">center_vertical|right</item>
</style>
It looks normal on Android 4.x, but on Android 2.x devices I get just white dialog window with buttons (all text is white with default sizes)
How I can fix it?
P.S. Please, help me! I cannot publish my app because of this only...
I'm using ActionBarSherlock and HoloEverywhere in my app. I used the ActionBar Style Generator to generate my styles and then modified them a bit by hand for text colors, etc.
I'm having a problem where my ActionBar looks correct on my Android 4.2 device (that is, orange with white text), but on my Android 2.3 device the ActionBar is black with grey text.
Does anyone know what might cause this?
<style name="Theme.MyApp" parent="#style/Holo.Theme.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_MyApp</item>
<item name="android:popupMenuStyle">#style/PopupMenu.MyApp</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.MyApp</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.MyApp</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.MyApp</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.MyApp</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_MyApp</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_MyApp</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.MyApp</item>
<!-- <item name="android:textColorPrimary">#FFFFFF</item> -->
<item name="android:spinnerDropDownItemStyle">#style/ActionBar.Solid.MyApp.NavigationDropDownStyle</item>
</style>
<style name="ActionBar.Solid.MyApp" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/ab_solid_MyApp</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_MyApp</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_MyApp</item>
<item name="android:progressBarStyle">#style/ProgressBar.MyApp</item>
<item name="android:titleTextStyle">#style/ActionBar.Solid.MyApp.TitleTextStyle</item>
</style>
<style name="ActionBar.Solid.MyApp.NavigationDropDownStyle" parent="#android:style/Widget.Holo.DropDownItem.Spinner">
<item name="android:textAppearance">#style/ActionBar.Solid.MyApp.NavigationDropDownStyle.TextStyle</item>
</style>
<style name="ActionBar.Solid.MyApp.NavigationDropDownStyle.TextStyle" parent="#android:style/Widget">
<item name="android:textColor">#color/white</item>
<item name="android:textSize">18sp</item>
</style>
<style name="ActionBar.Solid.MyApp.TitleTextStyle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
<item name="android:textSize">18sp</item>
<!-- <item name="android:fontFamily">sans-serif-medium</item> -->
</style>
<style name="ActionBar.Transparent.MyApp" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#drawable/ab_transparent_MyApp</item>
<item name="android:progressBarStyle">#style/ProgressBar.MyApp</item>
</style>
<style name="PopupMenu.MyApp" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_MyApp</item>
</style>
<style name="DropDownListView.MyApp" parent="#android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_MyApp</item>
</style>
<style name="ActionBarTabStyle.MyApp" parent="#android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_MyApp</item>
</style>
<style name="DropDownNav.MyApp" parent="#android:style/Widget.Holo.Spinner">
<item name="android:background">#drawable/spinner_background_ab_MyApp</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_MyApp</item>
<item name="android:dropDownSelector">#drawable/selectable_background_MyApp</item>
</style>
<style name="ProgressBar.MyApp" parent="#android:style/Widget.Holo.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_MyApp</item>
</style>
<style name="ActionButton.CloseMode.MyApp" parent="#android:style/Widget.Holo.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_MyApp</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.MyApp.Widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu.MyApp</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.MyApp</item>
</style>
--------------- EDIT ----------------------
So I'm now having a problem where the action bar is taking up the entire screen on the Android 2.3 device (but works fine on Android 4.2). Do I need to remove the "android:" from the parent attributes?
parent="#android:style/Widget.Holo.ListPopupWindow"
When I tried this, Eclipse was unable to find the theme.
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.MyApp" parent="#style/Holo.Theme.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_MyApp</item>
<item name="android:popupMenuStyle">#style/PopupMenu.MyApp</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.MyApp</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.MyApp</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.MyApp</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.MyApp</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_MyApp</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_MyApp</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.MyApp</item>
<!-- <item name="android:textColorPrimary">#FFFFFF</item> -->
<item name="android:spinnerDropDownItemStyle">#style/ActionBar.Solid.MyApp.NavigationDropDownStyle</item>
<item name="actionBarItemBackground">#drawable/selectable_background_MyApp</item>
<item name="popupMenuStyle">#style/PopupMenu.MyApp</item>
<item name="dropDownListViewStyle">#style/DropDownListView.MyApp</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.MyApp</item>
<item name="actionDropDownStyle">#style/DropDownNav.MyApp</item>
<item name="actionBarStyle">#style/ActionBar.Solid.MyApp</item>
<item name="actionModeBackground">#drawable/cab_background_top_MyApp</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_MyApp</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.MyApp</item>
<!-- <item name="textColorPrimary">#FFFFFF</item> -->
<item name="spinnerDropDownItemStyle">#style/ActionBar.Solid.MyApp.NavigationDropDownStyle</item>
</style>
<style name="ActionBar.Solid.MyApp" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/ab_solid_MyApp</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_MyApp</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_MyApp</item>
<item name="android:progressBarStyle">#style/ProgressBar.MyApp</item>
<item name="android:titleTextStyle">#style/ActionBar.Solid.MyApp.TitleTextStyle</item>
<item name="background">#drawable/ab_solid_MyApp</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_MyApp</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_MyApp</item>
<item name="progressBarStyle">#style/ProgressBar.MyApp</item>
<item name="titleTextStyle">#style/ActionBar.Solid.MyApp.TitleTextStyle</item>
</style>
<style name="ActionBar.Solid.MyApp.NavigationDropDownStyle" parent="#android:style/Widget.Holo.DropDownItem.Spinner">
<item name="android:textAppearance">#style/ActionBar.Solid.MyApp.NavigationDropDownStyle.TextStyle</item>
</style>
<style name="ActionBar.Solid.MyApp.NavigationDropDownStyle.TextStyle" parent="#android:style/Widget">
<item name="android:textColor">#color/white</item>
<item name="android:textSize">18sp</item>
</style>
<style name="ActionBar.Solid.MyApp.TitleTextStyle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
<item name="android:textSize">18sp</item>
<!-- <item name="android:fontFamily">sans-serif-medium</item> -->
</style>
<style name="ActionBar.Transparent.MyApp" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#drawable/ab_transparent_MyApp</item>
<item name="android:progressBarStyle">#style/ProgressBar.MyApp</item>
<item name="background">#drawable/ab_transparent_MyApp</item>
<item name="progressBarStyle">#style/ProgressBar.MyApp</item>
</style>
<style name="PopupMenu.MyApp" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_MyApp</item>
</style>
<style name="DropDownListView.MyApp" parent="#android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_MyApp</item>
</style>
<style name="ActionBarTabStyle.MyApp" parent="#android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_MyApp</item>
<item name="background">#drawable/tab_indicator_ab_MyApp</item>
</style>
<style name="DropDownNav.MyApp" parent="#android:style/Widget.Holo.Spinner">
<item name="android:background">#drawable/spinner_background_ab_MyApp</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_MyApp</item>
<item name="android:dropDownSelector">#drawable/selectable_background_MyApp</item>
<item name="background">#drawable/spinner_background_ab_MyApp</item>
</style>
<style name="ProgressBar.MyApp" parent="#android:style/Widget.Holo.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_MyApp</item>
</style>
<style name="ActionButton.CloseMode.MyApp" parent="#android:style/Widget.Holo.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_MyApp</item>
<item name="background">#drawable/btn_cab_done_MyApp</item>
</style>
</resources>
As per the official docs, you need to also declare the attributes without the android: namespace. In your case, those attributes are only getting applied to the native implementation.