Change Contextual Action Bar Overflow Style - android

I would like to change the style (text and/or background colours) of the overflow area of the contextual action bar.
At present the text colour is taken from android:textColor in the current theme, but I want to use a different colour for the overflow dropdown.
I can change the background colour of the CAB using android:actionModeBackground, but not the overflow area.
My style currently looks like this:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:textColor">#3e3e3e</item>
</style>
Any ideas?
Thank you

Use following item
<item name="actionOverflowMenuStyle">#style/LStyled.PopupMenu.OverflowMenu</item>
And define the style LStyled.PopupMenu.OverflowMenu
<style name="LStyled.PopupMenu.OverflowMenu" parent="#style/Widget.AppCompat.PopupMenu.Overflow">
<item name="android:popupBackground">#drawable/bground</item>
</style>

Related

When trying to use the material theme on Android, my title bar is not using the primary colour

From my research, it appears that when using the material theme on Android the title bar should take on the primary color but for me, it stays black. I know the theme itself is working as things did change to black when I first applied the default(dark) theme. I have this set in the styles.xml file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:statusBarColor">#color/colorPrimaryDark</item>
</style>
</resources>
The colors referenced from colors.xml are working as they show up on the s the de in android studio.
I have tried looking for a way to manually change the title bar but I have only found ways to do it programatically and not through layout files. I have attached a pic of what the title bar currently looks like and what i would like it to look like below:
Current title bar
What I want it to look like
Change it to
<style name="AppTheme" parent="android:Theme.Material">
<!-- Customize your theme here. -->
<item name="android:colorPrimary">#color/colorPrimary</item>
<item name="android:colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="android:colorAccent">#color/colorAccent</item>
<item name="android:statusBarColor">#color/colorPrimaryDark</item>
</style>

Android - How to change text color of action tab menu?

I'm trying to tweak my app with some custom colors but I cannot change the text color of the action bar.
This is how it is currently showing:
If you look close you might see letters in the white tab bar. I'm trying to change this color to black without changing anything else of the action bar.
This is how my styles.xml looks like:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/default_green</item>
<item name="android:backgroundStacked">#color/stacked_white</item>
<item name="android:backgroundSplit">#color/sa_green</item>
</style>
Any help is appreciated.
You can make your custom theme here:
http://jgilfelt.github.io/android-actionbarstylegenerator/
Which includes all tabs and other component.
Try this ...
This should be in the theme
<item name="actionBarTabTextStyle">#style/tabtextcolor</item>
<item name="android:actionBarTabTextStyle">#style/tabtextcolor</item>
This should be where you define the tab text color.
<style name="tabtextcolor" parent="#style/Widget.Sherlock.ActionBar.TabText">
<item name="android:textColor">#android:color/white</item>
</style>

Change ActionBar spinner arrow color

I styled my actionbar like so, which results in a normal spinner and not an action bar spinner (without the line on the bottom). But I do want it to be white and prefer to not user my own drawables for this and use the android's spinner style. (See below what the result is).
<style name="AppTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:actionOverflowButtonStyle">#style/AppTheme.OverFlow</item>
<item name="android:actionDropDownStyle">#style/AppTheme.actionBarDropDown</item>
<item name="android:spinnerDropDownItemStyle">#style/DropDownList</item>
<item name="android:actionBarSize">48dp</item>
<item name="actionBarSize">48dp</item>
</style>
<style name="AppTheme.actionBarDropDown" parent="android:style/Widget.Holo.Spinner">
<!--<item name="android:background">#android:style/ab</item>-->
</style>
<style name="DropDownList" parent="#android:style/Widget.Holo.Light.ListView.DropDown">
<!-- background of the list menu -->
<item name="background">#android:color/background_light</item>
<item name="android:background">#android:color/background_light</item>
<item name="android:popupBackground">#android:color/background_light</item>
<!-- dividers -->
<item name="android:divider">#color/border_color</item>
<item name="android:dividerHeight">1dip</item>
<!-- item selected -->
<!--<item name="android:dropDownSelector">#android:color/holo_blue_dark</item>-->
<!--<item name="android:listSelector">#android:color/holo_blue_dark</item>-->
</style>
as you see the line breaks my design of the title.
Does anyone know what I could change to use a normal actionbar spinner drawable?
I can't seem to find this anywhere on stack.
Check the comments of the question, it's based on resources which don't have a white arrow, it's grey and it's not for the actionbar. So the best option is to use the generator

How to change the overflow icon of the contextual action bar without changing it for the standard action bar?

My app's theme looks like shown in the following screenshot:
As the theme is based on Theme.Holo.Light which contains dark action bar texts and overflow icon, I adjusted the overflow icon using the following style:
<style name="ActionBar.Light" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background">#color/highlight</item>
<item name="android:titleTextStyle">#style/TextAppearance.ActionBar.Title.Light</item>
<item name="android:subtitleTextStyle">#style/TextAppearance.ActionBar.Subtitle.Light</item>
</style>
...
<style name="Theme.Light" parent="#android:style/Theme.Holo.Light">
...
<item name="android:actionBarStyle">#style/ActionBar.Light</item>
<item name="android:actionOverflowButtonStyle">#android:style/Widget.Holo.ActionButton.Overflow</item>
...
</style>
When one or more list entries are checked I want to show a white contextual action bar, but unfortunately the white overflow icon isn't visible on the white background:
Any idea on how to change the overflow icon only for the contextual bar -- either via style or programatically?
Final Workaround (February 27 2014)
It seems as there isn't an option to change the overflow icon of the contextual action bar independent from the one of the standard action bar. So I had no other choice but changing the background color of the contextual bar to a dark gray, to make the white overflow button visible:
The icons on the right are under my control, so it was easy to change them. The "done" icon on the left and the text (check counter) can easily be changed using theme attributes. Only the thin separator between the "done" icon and the check counter cannot be changed using attributes. They would require a custom layout -- that's why I left it how it is for now.
Here's my contextual bar style and the relevant part from the theme:
<style name="TextAppearance.ActionBar.Title" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="TextAppearance.ActionBar.Title.Light">
<item name="android:textColor">#ffffff</item>
</style>
<style name="ContextualBar.Light" parent="android:style/Widget.Holo.ActionMode">
<item name="android:background">#666666</item>
<item name="android:titleTextStyle">#style/TextAppearance.ActionBar.Title.Light</item>
<item name="android:actionMenuTextColor">#ffffff</item>
</style>
<style name="Theme.Light" parent="#android:style/Theme.Holo.Light">
...
<item name="android:actionBarStyle">#style/ActionBar.Light</item>
<item name="android:actionModeStyle">#style/ContextualBar.Light</item>
<item name="android:actionModeCloseDrawable">#drawable/ic_action_done</item>
<item name="android:actionOverflowButtonStyle">#android:style/Widget.Holo.ActionButton.Overflow</item>
<item name="android:actionMenuTextColor">#ffffff</item>
...
</style>
Ads: You can see the full result in the final app "uPod" which is available at Google play!
On your theme and assuming your using Appcompat
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:actionOverflowButtonStyle">#style/OverFlowStyle</item>
</style>
<style name="OverFlowStyle" parent="Widget.AppCompat.ActionButton.Overflow">
<item name="android:src">#drawable/your_selector_drawable_here</item>
</style>

ActionBarSherlock theme color

I wish to replace red color to the default color of ActionBarSherlock, i search but don't know what to insert it the style.xml, below is my code:
<style name="Theme.Red" parent="Theme.Sherlock.Light">
<!-- what should i insert here? -->
</style>
What should i need to do if i want to change the color of the green highlight area? The whole bar, not the title only.
So, you want a red action bar?
<style name="Theme.Red" parent="Theme.Sherlock">
<item name="android:actionBarStyle">#style/RedActionBar</item>
<item name="actionBarStyle">#style/RedActionBar</item>
</style>
<style name="RedActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#f00</item>
</style>

Categories

Resources