Holo Dark TabWidget style for Holo Light Theme - android

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".

Related

themes.xml not setting app bar colour in dark theme

In my themes.xml I have
<item name="colorPrimary">#color/teal_200</item>
This sets the app bar colour AOK
However if I set my themes.xml (night) to
<item name="colorPrimary">#color/teal_200</item>
And I engage dark theme, the colour setting is ignored
Can anybody please explain what I am missing ?
If your using Material Design then add this in your AppTheme
parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge"

Unable to set custom background colour of ActionBar

I'm trying to make the background colour of my ActionBar a colour corresponding to the code. For some reason my app crashes when it reaches this line of code.
getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#3f9845")));
When I remove it the error goes (ActionBar background is set to black by default). I've tried rearranging the line to be above and below
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_register1);
but still no luck.
This is the theme I'm using if it has any relevance
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> </style>
Thanks in advance for any help
If you are using AppCompat, you need to call getSupportActionBar() instead.
If you want to change the color by style with the recent versions of AppCompat, you just need to set the "colorPrimary" attribute in your theme to the color you want.
you can set it in the style:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#color/my_action_bar_color</item>
</style>

Custom Theme 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

How can I force my Widgets to use a dark theme?

In my application, I used Theme.Holo.Light to make the ActionBar look light and I am pretty pleased with the result.
The only problem is that all my widgets (EditText, Spinner, etc..) are acting like the background was white, while I set it a dark blue:
Is there an easy way in the style.xml file where I can force everything to act like the theme was dark?
I know that I could theme the text color, background resources, etc.. But this would be a huge work.
Thank a lot for any hint that could help me to achieve that easily.
Edit: what sounds the best solution, but not working:
<style name="AppBaseTheme" parent="#android:Theme.Holo">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
</style>
To solve this (the easy way) you should use Theme.Holo. And Change the actionbar to Theme.Holo.Light.
extend theme:
<style name="MyTheme.Dark" parent="android:Theme.Holo.Light.ActionBar"></style>
use getActionBar().getThemedContext() as the context for inflating your views.
You can use Holoeverywhere library to achieve your result.
HoloEveryWhere

how to change background of overflow menuitem

I am trying to change the blue background of a focussed/pressed menuitem in the overflow menu.
I'm talking about this:
I think I've overwritten every possible attribute from the Themeand Theme.Holo in Themes.xml and went to each style in Styles.xml but couldn't change the blue background.
EDIT
i figured out that the style i should override is android:dropDownListViewStyle
but it didn't work at all.
but then i changed the theme from Theme.Holo.Light.DarkActionBar to Theme.Holo.Light and guess what? it worked!!
so, can anyone shed some light on this?? how can i change the color on a theme with DarkActionBar??
ok, i found a solution for my problem: link to a post in the ActionBarSherlock google group
i've overseen this entry: android:actionBarWidgetTheme in the Theme.Holo.Light.DarkActionBar theme.
now all i had to do is define a theme that overrides Theme.Holo with one style in it: <item name="android:dropDownListViewStyle">#style/myDropDownListView</item> and point to this theme instead.
<!-- theme referenced by actionBarWidgetTehme style -->
<style name="Theme.DropDown.Dark" parent="android:style/Theme.Holo">
<item name="android:dropDownListViewStyle">#style/myDropDownListView</item>
</style>
<!-- my main theme -->
<style name="DarkActionBarRedActionMode" parent="android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarWidgetTheme">#style/Theme.DropDown.Dark</item>
</style>
declare a selector drawable, and put it as background of listview item.
refer to drawable resource

Categories

Resources