In my application I am using my own theme based on the Theme.Holo.Light
However I have customised the actionBarStyle, setting the background drawable to a blue gradient to fit with my app's style.
However, with the Halo light theme, the action bar text is dark, & the default icons, such as the Up Nav arrow and the menu icon are dark, these don't go on my blue gradient.
As you can see from my XML below, I have managed to correct the title text colour but I can't find the attribute I need to override for the icons.
How can I change tell the theme to effectively use the icons on the ActionBar from Theme.Halo
instead of those Theme.Halo.Light but making the rest of my application remain using Theme.Halo.Light
Here's my current XML
<style name="MyLightTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background">#drawable/blue_gradient_light</item>
<item name="android:titleTextStyle">#style/Theme.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.ActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/solid_white</item>
</style>
Thanks for your help
Use Theme.Holo.Light.DarkActionBar as your base if you want to do this. It will take care of these details.
Related
I'm using last release of support library (V21) which include material themes (under Theme.AppCompat name) and I want to put ActionBar title in white. I tried to achieve it by using textColorPrimary (as it's shown there) attribut in my custom theme
<style name="AppBaseTheme" parent="#style/Theme.AppCompat.Light">
<item name="colorPrimary">#color/orange</item>
<item name="colorPrimaryDark">#color/orange_dark</item>
<item name="colorAccent">#color/white</item>
<!-- This attribut set text color -->
<item name="android:textColorPrimary">#color/white</item>
</style>
With this I got a white actionbar title but all other text (textview, edittext) were white too...
Is there a way to change only actionbar title color with recently released features or the only way is to use a custom style for action bar, just like it was the case with Holo ?
Use #style/Theme.AppCompat.Light.DarkActionBar to invert the text color only in the Action Bar.
I'm trying to do what I thought would be simple but after two days of searching for an answer, have given up. I am writing an app and I want the user to be able to switch from the Holo dark theme to the Holo light theme via preferences. Holo Light will be white window background with black text, and Holo dark will be the inverse. I also want them to be able to set the color of the action bar to something they like. Problem I'm having is when I succeed in flipping the background of the main window (by using android:background in styles.xml), the action bar icon and buttons do not take on the color of the action bar. If I use android:windowBackground in styles.xml, the action bar now looks fine and changes color, but the main window background does not. Here is the xml from styles.xml:
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
<style name="ThemeHoloDark" parent="android:Theme.Holo">
<item name="android:background">#color/background_holo_dark</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:textColor">#0734f9</item>
<!-- blue -->
</style>
<style name="ThemeHoloLight" parent="android:Theme.Holo.Light">
<item name="android:background">#color/background_holo_light</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:textColor">#f90707</item>
</style>
The code I am using to switch theme is this:
if (themeLight == true )
setTheme( R.style.ThemeHoloLight);
else
setTheme( R.style.ThemeHoloDark);
actionBar = getActionBar();
setActionBarTheme(this, actionBar );
Here are some screenshots of what I'm talking about. The first couple show the action bar flipping from light to dark when the preferences are selected:
--Apparently I don't have enough reputation points to post images. :(
I have tried pretty much everything I have found on the web but must be missing something. Any help will be appreciated!
You need to create a seperate custom actionBarStyle like this . android:background in the ActionBarStyle will set the background for action bar.
<style name="ActionBarStyle" parent="android:Widget.Holo.Light.ActionBar">
<item name="android:titleTextStyle">#style/HoloTitleText</item>
<item name="android:background">#color/Red</item>
</style>
and set it to the main custom style .android:background in the ThemeHoloLight will set the background for window.
<style name="ThemeHoloLight" parent="android:Theme.Holo.Light">
<item name="android:background">#color/DarkGreen</item>
<item name="android:actionBarStyle">#style/ActionBarStyle</item>
</style>
You can also change the action bar title color like this
<style name="HoloTitleText" parent="android:TextAppearance.Holo">
<item name="android:textColor">#color/white</item>
</style>
Hope this is what your looking for.
I am trying to set a custom actionbar for my app like so
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 11 theme customizations can go here. -->
<item name="android:actionMenuTextColor">#FFFFFF</item>
<item name="android:actionBarWidgetTheme">#style/MyActionWidgetTheme</item>
<item name="android:actionBarStyle">#style/BasicActionBar</item>
</style>
<style name="BasicActionBar" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#color/red</item>
</style>
when i don't include
<item name="android:actionBarStyle">#style/BasicActionBar</item>
The actionbar and tab bar appear dark but i want to set the actionbar's color and keep the tabs dark. When i set the style the action bar changes color but the tabs turn to white.
I am pretty sure the problem is
parent="android:Widget.Holo.ActionBar"
I have tried any bunch of different possible values for this but can't find one that keeps the tab bar dark
this link helped me http://jgilfelt.github.io/android-actionbarstylegenerator/
#style/Widget.Sherlock.Light.ActionBar.Solid.Inverse
did the trick
If you set your app's theme to Holo.Light then you can get light popup menus, dark text, etc, which is what I want. However, my action bar is using a custom darker color and I want the overflow menu (dots) to go back to being white (as they are when you use Theme.Holo). What do I need to override in my theme to make that happen?
<style name="Theme" parent="#android:style/Theme.Holo.Light">
<item name="actionOverflowButtonStyle">#style/OverflowStyle</item>
</style
<style name="OverflowStyle" parent="#android:style/Widget.ActionButton.Overflow">
<item name="android:src">#drawable/custom_asset</item>
</style>
Or use the dark action bar theme
<style name="Theme" parent="#android:style/Theme.Holo.Light.DarkActionBar" />
I am working on an app which will be full-screen, but will utilize some of the functionalities of the ActionBar. With the Ice Cream Sandwhich release, I see that I get a blue line divider/separator as part of the ActionBar. Normally, it would be good for consistency, but in my case I need to remove the divider.
How can I remove or style the divider of the ActionBar in ICS?
Tried setting a custom theme with "android:style/Widget.Holo.ActionBar" as parent.
However, settings such as the one below has no effect
<item name="android:divider">#FFFFFF</item>
The graphic asset containing the blue bottom line is the background of the action bar's container view and is set to #android:drawable/ab_transparent_dark_holo when using the default Holo Dark theme.
To remove this line, you'll need to create a custom style for your action bar (based on Widget.Holo.ActionBar or Widget.Holo.Light.ActionBar (or the .Solid variants) and set the android:background to something that doesn't include the bottom border:
<style name="MyTheme" parent="android:Theme.Holo">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#drawable/your_background_here</item>
</style>
Note: Holo Dark/Light action bars have solid and transparent styles; this blue line appears by default for the transparent style. Holo Dark action bars are transparent by default and Holo Light action bars are solid by default.
Here is a simple way to remove the divider, works from API 07 using the actionbarcompat from the support library:
#Override
public void onCreate(Bundle savedInstanceState) {
//...
getSupportActionBar().setBackgroundDrawable(
getResources().getDrawable(R.drawable.whatever_you_want));
//...
}
Changing the activity theme to Theme.Holo.Light.DarkActionBar removes the blue line.
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:windowBackground">#android:color/black</item>
<item name="android:textColor">#android:color/white</item>
</style>
If you still want a black background you may want to change android:windowBackground and/or android:textColor
add this <item name="android:windowContentOverlay">#null</item> to your app theme.