I am using Theme.Holo in My Current android app.
Above is the overflow UI from my current theme.
I want to customize overflow menu's background color to RGB (245, 243, 239), and the font color to RGB (64, 64, 64).
Following is the style.xml I am using
<style name="CustomActivityTheme" parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/CustomActivityTheme.ActionBar</item>
<item name="android:actionMenuTextColor">#000000</item>
<item name="android:divider">#drawable/action_bar_div</item>
<item name="android:actionOverflowButtonStyle">#style/MyActionButtonOverflow</item>
</style>
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">#drawable/overflow</item>
</style>
<style name="CustomActivityTheme.ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/actionbar_bg</item>
<item name="android:titleTextStyle">#style/CustomActivityTheme.ActionBar.Text</item>
<item name="android:subtitleTextStyle">#style/CustomActivityTheme.ActionBar.Text</item>
</style>
<style name="CustomActivityTheme.ActionBar.Text" parent="#android:style/TextAppearance">
<item name="android:textColor">#000000</item>
<item name="android:textSize">16sp</item>
</style>
<style name="activated" parent="android:Theme.Holo">
<item name="android:background">?android:attr/activatedBackgroundIndicator</item>
</style>
<!-- style for removing the floating dialog -->
<style name="CustomDialogTheme">
<item name="android:windowIsFloating">false</item>
<item name="android:windowNoTitle">true</item>
</style>
<!-- style for transparent image resource activity -->
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">#style/MyAnimation.Window</item>
</style>
<!-- Animations for a non-full-screen window or activity. -->
<style name="MyAnimation.Window" parent="#android:style/Animation.Dialog">
<item name="android:windowEnterAnimation">#anim/grow_from_middle</item>
<item name="android:windowExitAnimation">#anim/shrink_to_middle</item>
</style>
<!-- style for transparent audio and video resource activity -->
<style name="Theme.Transparent_Player" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">#style/MyPlayerAnimation.Window</item>
</style>
<!-- Animations for a non-full-screen window or activity. -->
<style name="MyPlayerAnimation.Window" parent="#android:style/Animation.Dialog">
<item name="android:windowEnterAnimation">#anim/grow_from_action_bar</item>
<item name="android:windowExitAnimation">#anim/shrink_to_action_bar</item>
</style>
How can I customize theme to match overflow menu's background color to RGB (245, 243, 239), and the font color to RGB (64, 64, 64) in above code?
Thanks in advance..
to change text color you can use :
<item name="android:textAppearanceLargePopupMenu" >#style/m_textAppearanceLargePopupMenu</item>
<item name="android:textAppearanceSmallPopupMenu" >#style/m_textAppearanceSmallPopupMenu</item>
<style name="m_textAppearanceLargePopupMenu" parent="#android:style/TextAppearance.Holo.Widget.PopupMenu.Large">
<item name="android:textColor">#FFF</item>
</style>
<style name="m_textAppearanceSmallPopupMenu" parent="#android:style/TextAppearance.Holo.Widget.PopupMenu.Small">
<item name="android:textColor">#FFF</item>
</style>
this will change the popup menu text color to white
Try this:
<style name="CustomActivityTheme" parent="#android:style/Theme.Holo">
...
<item name="android:popupMenuStyle">#style/MyPopupMenu</item>
...
</style>
<style name="MyPopupMenu" parent="android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:background">#f5fdef</item>
</style>
I found it at this post
<style name="MyActionBar3" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="android:background">#color/ActionBarBackground</item>
</style>
<style name="MyActionBarDropDownStyle" parent="">
<item name="android:background">#00FF00</item>
<item name="android:divider">#ff0000</item>
<item name="android:dividerHeight">1dp</item>
<item name="android:textColor">#FFFFFF</item>
<item name="android:textSize">10sp</item>
</style>
<style name="MyTextStyle" parent="#style/Widget.AppCompat.Light.Base.ListPopupWindow">
<item name="android:popupBackground">#FF0000</item>
</style>
Apply the style to android:textAppearanceLargePopupMenu" item's attribute
Related
I'd like to remove shadow around my action bar overflow menu, but i haven't found any attributes allowing that. I'm extending Theme.AppCompat.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="actionOverflowButtonStyle">#style/OverflowButton</item>
<item name="actionOverflowMenuStyle">#style/OverflowMenu</item>
<item name="actionBarStyle">#style/MyActionBarLogo</item>
<item name="android:dropDownListViewStyle">#style/PopupMenuListView</item>
<item name="dropDownListViewStyle">#style/PopupMenuListView</item>
<item name="android:textColor">#color/black</item>
<item name="android:popupMenuStyle">#style/PopupMenu</item>
</style>
<style name="MyActionBarLogo" parent="Widget.AppCompat.ActionBar">
<item name="background">#color/white</item>
<item name="displayOptions">useLogo|showHome</item>
<item name="elevation">0dp</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="OverflowButton" parent="#style/Widget.AppCompat.ActionButton.Overflow">
<item name="android:src">#mipmap/menu_logo</item>
</style>
<style name="OverflowMenu" parent="#style/Widget.AppCompat.PopupMenu.Overflow">
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">52dp</item>
<item name="android:dropDownHorizontalOffset">10dp</item>
</style>
<style name="PopupMenuListView" parent="#style/Widget.AppCompat.ListView.DropDown">
<item name="android:divider">#drawable/menu_divider</item>
<item name="android:dividerHeight">1dp</item>
<item name="android:textColor">#color/black</item>
<item name="android:background">#color/white</item>
</style>
<style name="PopupMenu" parent="#style/Widget.AppCompat.ListPopupWindow">
<item name="android:popupBackground">#color/white</item>
</style>
http://imgur.com/5mbceT9
You can try solution this
getSupportActionBar().setElevation(0);
UPDATE
<style name="MyActionBarLogo" parent="Widget.AppCompat.ActionBar">
<item name="background">#color/white</item>
<item name="displayOptions">useLogo|showHome</item>
<item name="elevation">0dp</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:actionDropDownStyle">#style/DropDownMenuStyle</item>
</style>
<style name="DropDownMenuStyle" parent="Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">#android:color/transparent</item>
</style>
You need to apply the zero elevation style to the correct element, in this case actionOverflowMenuStyle.
(This is using appcompat)
<style name="Theme.myapp" parent="Theme.AppCompat.Light">
<item name="actionOverflowMenuStyle">#style/Theme.myapp.Widget.PopupMenu.Overflow</item>
</style>
Then
<style name="Theme.myapp.Widget.PopupMenu.Overflow" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="elevation">0dp</item>
<item name="android:popupElevation">0dp</item>
</style>
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>
I want to Change Action mode background and title color in it . i tried this But nothing has changed
Here is my styles.xml file
<style name="AppBaseTheme" parent="android:Theme.Light"></style>
<style name="AppTheme" parent="AppBaseTheme"></style>
<style name="LiveoActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">#style/LiveoActionBar</item>
</style>
<style name="LiveoActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="titleTextStyle">#style/Liveo.TitleTextStyle</item>
<item name="subtitleTextStyle">#style/Liveo.SubTitleTextStyle</item>
<item name="background">#color/green_google_play</item>
</style>
<style name="Liveo.TitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
<item name="android:textStyle">normal</item>
</style>
<style name="Liveo.SubTitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle">
<item name="android:textColor">#color/white</item>
<item name="android:textStyle">normal</item>
</style>
<style name="menu_labels_style">
<item name="android:background">#drawable/fab_label_background</item>
<item name="android:textColor">#color/white</item>
</style>
</resources>
Update your code as follows and try ,
<style name="LiveoActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/LiveoActionBar</item>
</style>
<style name="LiveoActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">#style/Liveo.TitleTextStyle</item>
<item name="android:subtitleTextStyle">#style/Liveo.SubTitleTextStyle</item>
<item name="android:background">#color/green_google_play</item>
</style>
I try to change text color and size of my actionbar through the style resources:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.Example3" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarItemBackground">#drawable/selectable_background_example3</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Example3</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Example3</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Example3</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Example3</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Example3</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_example3</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_example3</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Example3</item>
</style>
<style name="ActionBar.Solid.Example3" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">#drawable/ab_solid_example3</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_example3</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_example3</item>
<item name="android:progressBarStyle">#style/ProgressBar.Example3</item>
</style>
<style name="Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle" parent="#android:style/TextAppearance.Medium">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#color/white</item>
</style>
<style name="ActionBar.Transparent.Example3" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/ab_transparent_example3</item>
<item name="android:progressBarStyle">#style/ProgressBar.Example3</item>
</style>
<style name="PopupMenu.Example3" parent="#android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_example3</item>
</style>
<style name="DropDownListView.Example3" parent="#android:style/Widget.Holo.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_example3</item>
</style>
<style name="ActionBarTabStyle.Example3" parent="#android:style/Widget.Holo.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_example3</item>
</style>
<style name="DropDownNav.Example3" parent="#android:style/Widget.Holo.Light.Spinner">
<item name="android:background">#drawable/spinner_background_ab_example3</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_example3</item>
<item name="android:dropDownSelector">#drawable/selectable_background_example3</item>
</style>
<style name="ProgressBar.Example3" parent="#android:style/Widget.Holo.Light.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_example3</item>
</style>
<style name="ActionButton.CloseMode.Example3" parent="#android:style/Widget.Holo.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_example3</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Example3.Widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu.Example3</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Example3</item>
</style>
</resources>
The above style.xml contains following code part, which should change text color and size, but it happens nothing on my actionbar:
<style name="Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle" parent="#android:style/TextAppearance.Medium">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#color/white</item>
</style>
What is wrong?
Thanks!!
<item name="android:titleTextStyle">#style/Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle</item>
is missing in <style name="ActionBar.Solid.Example3">
The problem is that you need to link the third block of style from inside the second block of style:
<style name="ActionBar.Solid.Example3" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">#drawable/ab_solid_example3</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_example3</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_example3</item>
<item name="android:progressBarStyle">#style/ProgressBar.Example3</item>
<item name="android:titleTextStyle">#style/Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle</item>
</style>
I want to make actionbardropdown and overflow menu transparent How can I do this?
I have tried
<style name="Theme.MyTheme" parent="#style/Theme.Sherlock.Light">
<item name="android:actionBarStyle">#style/myactionbar</item>
<item name="windowActionBarOverlay">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="actionDropDownStyle">#style/dropdown</item>
<item name="popupMenuStyle">#style/popupmenucolor</item>
<item name="actionBarStyle">#style/myactionbar</item>
<item name="dropDownListViewStyle">#style/dropdownlistview</item>
</style>
<style name="myactionbar" parent="#style/Widget.Sherlock.Light.ActionBar">
<item name="android:background">#android:color/transparent</item>
<item name="background">#android:color/transparent</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
</style>
<style name="ActionBarTabStyle" parent="#style/Widget.Sherlock.ActionBar.TabView">
<item name="background">#android:color/transparent</item>
<item name="android:background">#android:color/transparent</item>
</style>
<style name="dropdown" parent="#style/Widget.Sherlock.Light.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/transparent_background</item>
<item name="android:popupBackground">#drawable/dropdown</item>
<item name="android:dropDownSelector">#drawable/selectable_background_colors</item>
</style>
<style name="dropdownlistview" parent="#style/Widget.Sherlock.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/dropdown</item>
</style>
<style name="popupmenucolor" parent="#style/Widget.Sherlock.Light.ListPopupWindow">
<item name="android:popupBackground">#drawable/dropdown</item>
</style>
here #drawable/dropdown is a 9 patch semi transparent image which has 30% opacity
But it does not make the dropdown transparent. How can I get this?
Thanks