Custom Theme Android - android

In the app that I am making I want to theme some of my display widgets (dialog, actionbar, etc) but keep Theme.Holo as a parent for things I don't want to theme (buttons, spinners, etc)
So in my manifest I changed:
android:theme="#android:style/Theme.Holo"
to
android:theme="#style/CustomTheme"
and then in themes.xml I made my CustomTheme and overrode my actionbar and dialog:
<!-- Custom Holo (Dark) Theme -->
<style name="CustomTheme" parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/CarCastActionBar</item>
<item name="android:alertDialogTheme">#style/CustomDialogTheme</item>
<item name="android:dialogTheme">#style/CustomDialogTheme</item>
<item name="android:alertDialogStyle">#style/CustomDialogTheme</item>
</style>
only now my spinners have gone back to an ugly white instead of the flat transparent look.
Why is it doing this? I can attach pictures if it would help

The default Holo theme, which you are using expects a dark background. So the ui elements will have a white translucent color. Trying using the Holo Light theme to have darker ui elements.
android:Theme.Holo.Light

Related

Android how to set color of a view to that of another view programmatically at runtime?

In my app you can change the theme from Light to Dark and vice versa. What this is doing setting the theme to either Theme.AppCompat.Light.DarkActionBar or Theme.AppCompat and finishing and starting the activity for the layout to load again.
I want to be able to change the color of those three purple lines dividing the settings to the same color of another view in the layout (for example the text). When I switch to dark theme, I want the lines color to change to the exact same color of the text and vice versa for when I switch to light theme. Light theme => dark lines, Dark theme => light lines. I need to be able to do this programatically to whatever the text color is because it is a different shade in different API levels. This is why setting the colors to hard coded values won't work.
You could redefine the dark and light themes for the android:divider item by adding the following line to both the theme styles.
<item name="android:divider">your_color</item>
An example of dark theme style would be:
<style name="MyDesign" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimaryDark">yourcolor</item>
<item name="colorPrimary">yourcolor</item>
<item name="colorAccent">yourcolor</item>
<item name="android:textColorPrimary">#color/textColorPrimary</item>
<item name="android:textColorSecondary">#color/textColorSecondary</item>
<item name="android:divider">yourcolor</item>
<item name="android:windowBackground">#color/window_background</item>
</style>

Android Custom Theming in ActionBar/Tabs

I have the theme Holo.Light.DarkActionBar
The tabs are now set to white background, light gray text--very unreadable. I simply want to change the text to something much, much darker.
I have searched the styles to see if I can override but all I can do is change the background, not the text.
Can I do this in the styles.xml or do I have to do this programmaticly?
If you're referring to the ActionBar's tab see if this changes the color:
<!-- The theme for the activity -->
<style name="TabSpecialTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="#android:attr/actionBarTabTextStyle">#style/TabStyle</item>
</style>
<!-- Modify the text color -->
<style name="TabStyle" parent="android:Widget.Holo.Light.ActionBar.TabText.Inverse">
<item name="android:textColor">#F70000</item>
</style>
Of course don't forget to set the theme for the activity to #style/TabSpecialTheme in the manifest.

Holo Dark TabWidget style for Holo Light Theme

I've got a custom theme that inherits from Theme.Holo.Light.DarkActionBar and I'm trying to change the theme's tabWidget style so it to look like if the theme was Theme.Holo Dark.
I've tried this in my theme with no result
<style name="AppTheme" parent="android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:tabWidgetStyle">#android:style/Widget.Holo.TabWidget</item>
...
</style>
The only thing I can appreciate is there is a small change in the blue bar of the tab.
Any idea how to get it? Thanks!
Try also the items "android:tabStripLeft" and "android:tabStripRight".

Android ICS: Remove blue divider in ActionBar?

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.

Changing the action bar overflow icon to the dark version

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.

Categories

Resources