Theming with ABS and HoloEverywhere - android

I'm using HoloEverywhere and ActionbarSherlock to create my application. I've been successful in theming the listview i have in my main activity so that the color is grey instead of holo blue whenever pressed or focused. I would like to theme the preference options I have in a PreferenceActivity as well, but it only works for devices with pre-ICS. With devices running android 4.0+, whenever the option is pressed or focused, the color is still ICS blue.
Another question: I'm using a theme that's parent is Holo.Theme.Light.DarkActionBar. How would I make it so that it uses a light overflow popupmenu instead of the dark one? I've tried adding popupmenustyle to my styles, but I've had no luck
styles.xml:
<style name="Theme" parent="Holo.Theme.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background</item>
<item name="actionBarItemBackground">#drawable/selectable_background</item>
<item name="android:activatedBackgroundIndicator">#drawable/activated_background_holo_light</item>
<item name="activatedBackgroundIndicator">#drawable/activated_background_holo_light</item>
<item name="android:listChoiceBackgroundIndicator">#drawable/list_selector_holo_light</item>
<item name="android:actionBarStyle">#style/ActionBar</item>
<item name="actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar" parent="#style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="android:background">#666666</item>
<item name="android:icon">#drawable/icon</item>
<item name="background">#666666</item>
<item name="icon">#drawable/icon</item>
</style>

For me this works:
<item name="popupMenuStyle">#style/PopupMenu.Intellistats</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Intellistats</item>
where:
<style name="PopupMenu.Intellistats" parent="#style/Holo.ListPopupWindow">
<item name="android:popupBackground">#color/holo_orange_dark</item>
</style>

Related

Actionbar TextColors overriden when using Theme.Material

I building an application that uses ActionBarSherlock. I won't use ActionbarCompat so please focus on my question.
I made some code that can change the title color, as well as the subtitle color on the ActionBar. However when using my styles.xml for v21+ it will override those colors with the stock white colors (provided in Theme.Material)
Now I want to ask; what do I have to change in my code below to actually remove the Theme.Material colors override?
-EDIT
I noticed that it is working only when using a TextView in the Actionbar, however that's not what I want.
<style name="Theme.App.NoLight" parent="#android:style/Theme.Material">
<item name="android:colorAccent">#color/abs__holo_blue_light</item>
<item name="android:colorPrimary">#color/dark_holo</item>
<item name="android:logo">#android:color/transparent</item>
<item name="android:windowBackground">#color/dark_holo</item>
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar.NoLight</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="android:actionBarTabBarStyle">#style/ActionBarTabBarStyle</item>
<item name="android:actionBarTabTextStyle">#style/ActionBarTabTextStyle</item>
<item name="android:actionOverflowButtonStyle">#style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="android:homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
<item name="logo">#android:color/transparent</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="actionBarTabBarStyle">#style/ActionBarTabBarStyle</item>
<item name="actionBarTabTextStyle">#style/ActionBarTabTextStyle</item>
<item name="actionOverflowButtonStyle">#style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="actionBarStyle">#style/Widget.Styled.ActionBar.NoLight</item>
<item name="homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
</style>

Overflow Menu textColor with AppCompat (using Hardware Menu-Key)

I'm facing an issue on devices with a separate menu key (like the Samsung onces).
In some Activities the textcolor of the Overflow Menu Items is white when opened via the Menu-Key. Opening the Overflow via the three dots the textcolor is always black - like it should be.
Following a Screenshot which visualizes the issue. On the left side the everything is fine, overflow has been opened via the three dots. On the right side the menu has been opened via the Menu-Key:
My Theme:
<style name="AppThemeToolbar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/primary_color</item>
<item name="colorPrimaryDark">#color/primary_color_dark</item>
<item name="colorAccent">#color/accent_color</item>
<item name="android:textColorPrimary">#android:color/white</item>
<item name="android:textColorSecondary">#android:color/white</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">#color/action_mode_color</item>
<item name="actionBarPopupTheme">#style/ThemeOverlay.AppCompat.Light</item>
</style>
Note: I'm using the exact same Theme in multiple Activities though in 3 out of 5 everything is fine.
That's totally mind boggling and doesn't make sense.
So basically the question is: How can I fix this and why is the textcolor in some activities black and in others white (while they're all using the same Theme)?
What I've tried (found in other similar posts):
Setting the panelBackground. This works, unfortunately this isn't a solution for me since the textcolor switches at will between black and white - so there's simply no good background color I could set.
What didn't work:
android:panelTextAppearance
textAppearanceSmallPopupMenu
textAppearanceLargePopupMenu
popupMenuStyle
android:actionMenuTextColor & actionMenuTextColor
I don't wanna use SpannableStrings - approach seems to hacky
Finally found the solution!
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="actionBarPopupTheme">#style/HardwareOptionMenu</item>
</style>
<style name="HardwareOptionMenu" parent="ThemeOverlay.AppCompat.Dark">
<item name="android:textColorSecondary">#color/white</item>
<item name="android:colorBackground">#color/black</item>
</style>
<style name="AppThemeLL" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorBackground">#color/white</item>
<item name="android:textColorSecondary">#color/white</item>
</style>
This style worked for me and for the activity where you will use this theme extend Activity class.
Example:
public class TestActivity extends Activity
{}
Also your manifest will be
<activity android:name=".TestActivity"
android:label="Test"
android:theme="#style/AppThemeLL"/>
I faced similar issue. You could try this for AppCompat :-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="actionBarPopupTheme">#style/HardwareOptionMenu</item>
</style>
<style name="HardwareOptionMenu" parent="ThemeOverlay.AppCompat.Dark">
<item name="android:textColorSecondary">#color/black</item>
<item name="android:colorBackground">#color/white</item>
</style>

Hardware menu popup issue with Appcompat

I implemented in my application the (not so) new Appcompat theme with DarkActionBar. Everything works fine, except the popup from hardware menu button (or long press the recent button), that is rendered with white text.
Popup result:
Toolbar: http://i.stack.imgur.com/huWpm.png
Hard menu: http://i.stack.imgur.com/o5fmL.png
I solved an old issue with the popup from Action Mode, adding the actionBarPopupTheme attribute in the app theme. After this, the Hardware Menu popup is also getting the background from actionBarPopupTheme (Ok, we want! Before it was black), but not the textcolor.
The code:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">#style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="actionBarPopupTheme">#style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="Toolbar" parent="MatchWidth">
<item name="theme">#style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="popupTheme">#style/ThemeOverlay.AppCompat.Light</item>
<item name="android:layout_height">?attr/actionBarSize</item>
<item name="android:background">?attr/colorPrimary</item>
</style>
What is the right way to theme this?

Lollipop Theme issue

I am using sherlock action bar in my project, I have used Theme.Sherlock.Light.DarkActionBar
<style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="android:homeAsUpIndicator">#drawable/transparent</item>
<item name="homeAsUpIndicator">#drawable/transparent</item>
<item name="actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
<item name="android:titleTextStyle">#style/Widget.MyTheme.TitleTextStyle</item>
<item name="android:textAllCaps">false</item>
</style>
Problem :
I am getting light color menu with lollipop:
pre lollipop image :
Lollipop image :
can some one guide me, how can I get slimier menu color on both .
You can create a style which extends from actionbar sherlock to change color of you actionbar with other properties.
<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverflow">
<item name="actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
</style>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#ff000000</item>
<item name="background">#ff000000</item>
<item name="android:textColor">#CC3232</item>
</style>
For TextColor only
<style name="YOURTHEME.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">#color/yourColor</item>
<item name="textColor">#color/yourColor</item>
</style>
Last resort Solution
<item name="android:textColorPrimary">#color/yourColor</item>
You should create a new styles.xml in a separate values-21 folder. There, you can define a specific theme/style that suits your needs for Lollipop devices only.
You should be using the ActionBar or ToolBar provided by app-compat library, instead of ActionBarSherlock.
ABS uses replacement Holo themes for older versions, which I guess hasn't been updated in a while.

white theme not showing the text

I am currently making an app (Android 1.6) that can change between two different themes.
I made a custom theme that takes the Android light theme as a parent!
The trouble is that when I switch to white theme my text is not drawn but if I select something I can see the text. Furthermore when I switch themes my titleText, previous and next are the same as in my dark theme.
Here is the code I use for the theme:
<style name="Theme.White" parent="android:Theme.Light">
<item name="android:colorBackground">#color/text_color_dark</item>
<item name="android:textColor">#color/text_color_dark</item>
<item name="textPrev">#style/text_prev</item>
<item name="textRegular">#style/text_regular</item>
<item name="textTitle">#style/text_title</item>
<item name="textNext">#style/text_next</item>
<item name="pageBack">#style/page_back</item>
<item name="whiteBack">#style/white_back</item>
<item name="android:textColorPrimaryInverse">#android:color/primary_text_light</item>
</style>
</resources>
This is my style:
<style name="text_prev">
<item name="android:textColor">#color/text_color</item>
</style>
<style name="text_next">
<item name="android:textColor">#color/default_text_color_2</item>
</style>
<style name="text_regular">
<item name="android:textColor">#color/text_color_dark</item>
</style>
<style name="text_title">
<item name="android:textColor">#color/text_color_dark</item>
</style>
<style name="page_back">
<item name="android:background">#drawable/white_background</item>
</style>
<style name="white_back">
<item name="android:background">#drawable/white_container</item>
<item name="android:padding">10sp</item>
</style>
I use two more resources that are in my res/drawable folder. Everything works fine in the standard theme, but as soon as I switch to my light theme my text disappears.
Is there something that I'm doing wrong?
From your code snippet above you're setting both background and text to the same color i.e. "color/text_color_dark", these should be different.
<item name="android:colorBackground">#color/text_color_dark</item>
<item name="android:textColor">#color/text_color_dark</item>

Categories

Resources