styling ActionbarSherlock: textColor of the action-items - android

I was changing the background of the Actionbar in my App and to make text readable again I have to change the color of the text. I was successful with title/subtitle and the tab-texts, but I am struggling with the text of the action-items - they stay white no matter what I tried . Anyone has a hint on how to do that?
Also the overflow-icon is white which does not look too good on the wooden background - is that an extremely good reason to use the stuff below? I am not really sure what's the reason to not do it, but as I do not have a big device-test-park I better want to be sure ;-)
<!-- the following can be used to style the overflow menu button
only do this if you have an *extremely* good reason to!! -->
<!--<style name="MyOverflowButton" parent="Widget.Sherlock.ActionButton.Overflow">
<item name="android:src">#drawable/ic_menu_view</item>
<item name="android:background">#drawable/action_button_background</item>
</style>-->

I also struggled with this, but the solution to changing action item text color was:
<style name="My.Theme" parent="Theme.Sherlock.Light">
<item name="android:actionMenuTextColor">#android:color/white</item>
</style>
The key here was to use this attribute in the general theme, not in the actionbar style.

Try starting with android:theme="#style/Theme.Sherlock.Light" in your Manifest and then changing your styles. The light theme features dark action items. Or just look through the light theme to find out how to change them.

Related

ActionBar Light, but Holo Dark ActionMode CloseButton

I have a Theme.Holo.Light style, which is custom designed. Therefore I want to have the little tick on the contextual action mode in normal Theme.Holo style.
As you can see, it would look much better if the tick was white.
I thought the following would work, but no success.
<style name="PlayerTheme" parent="#android:style/Theme.Holo.Light">
...
<item name="android:actionModeCloseButtonStyle">#android:style/Widget.ActionButton.CloseMode</item>
</style>
Is there some way to make the tick white? Thanks!
You can copy the standard white check mark from the android icon pack into your project as a drawable. The icon pack can be found here: https://developer.android.com/design/downloads/index.html. It's under the 01_core_accept folder and named ic_action_accept.png.
Then, set the following property in your style file:
<item name="android:actionModeCloseDrawable">#drawable/ic_action_accept</item>
That should solve your problem.

Change background and text color of overflow items

I want to change the background and text colors of the pop up menu that appears when the user presses the overflow icon.
If I use Theme.Holo or Theme.Holo.Light it works, but I'm using Theme.Holo.Light.DarkActionBar and it never works. I'm starting to assume that it's an Android bug.
I'm testing on a Nexus 4 with 4.4.2 but it also doesn't work on an emulator with API 19.
After trying a lot of potential solutions that I came across here in StackOverflow, here is what I'm doing:
<style name="Theme.MyApp" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarWidgetTheme">#style/ActionBarWidget</item>
</style>
<style name="AndroidPitActionBarWidget" parent="android:Theme.Holo.Light">
<item name="android:popupMenuStyle">#android:style/Widget.Holo.Light.PopupMenu</item>
<item name="android:dropDownListViewStyle">#android:style/Widget.Holo.Light.ListView.DropDown</item>
</style>
That works but it changes the styling of the SearchView, which is another pain to change.
So I'm not considering this a solution.
What I want is to just change the background/text of the popup to the Light version, which is light background with black text.
I also tried setting those two attributes in the main theme instead of using the actionBarWidgetTheme.
It's really frustrating to waste hours on this kind of problems.
I also tried using Action Bar Style Generator to make the background white, but then the text is white and I can't change it to black.
Thanks very much in advance.
If you set the background color of that panel using the theme you get in the Action Bar Style Generator, you can try adding the android:textColor attribute of the drop down ListView.
If that does not work, you can alternately set the string color in code during your onCreateOptionsMenu method as detailed on this SO thread

Android app and Actionbar with different themes

In my Android application I need to have a black action bar and my content has a white background. The problem is that whenever I set the actionbar with a black background, all my dropdown spinners and textviews have a white background, and I can't see them together with my white content background. If I set the actionbar to white, the dropdown spinners and textviews have a black background and I can see them properly. I tryed customizing the style from the dropdown spinner with android:dropDownSpinnerStyle But i didn't succeed. How can I solve this?
Edit:
I just solved this issue regarding the Dropdown using the following:
<item name="android:dropDownSpinnerStyle">#style/customDropDownStyle</item>
<style name="customDropDownStyle" parent="#android:style/Widget.Holo.Light.Spinner">
</style>
But I still have this issue regarding an EditText, in which I can't see it's background. I just can't find the attribute I should work with in order to solve the issue.
It was much easier to keep the style of the APP in a way that the dropbox/textfields would be visible, but changing only the style of the Actionbar like that:
<item name="android:actionBarStyle">#style/ActionBar.Light</item>
<item name="android:actionOverflowButtonStyle">#android:style/Widget.Holo.ActionButton.Overflow</item>
<item name="android:actionBarTabStyle">#style/customActionBarTabStyle</item>

Android 3.0 ActionBar, changing colors

How can I change the color of the underline beneath the tabs? It's currently the light blue, and I can't find any resources on how to change this for Android 3.0.
Additionally, I'd like to change the text color for the menu items that show up on the right of the ActionBar as a result of: android:showAsAction="ifRoom|withText"
Anyone know how to change these?
You can control the appearance of the tabs by using the properties android:actionBarTabStyle, android:actionBarTabBarStyle, and android:actionBarTabTextStyle.
This section in the official developer guide shows a sample xml to customize the action bar's style.
Regarding the text of the menu options check the properties actionMenuTextAppearance and actionMenuTextColor.
As additional info, here's how I found out how to change the blue bar below each tab (the answer above is perfectly good, but I lacked little information that I put here, which might be useful to somebody).
You just need to change the background to a 9 patch drawable.
Here's how it looks like:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
Source available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable/actionbar_tab_bg.xml
9 patches available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable-mdpi
I know this was really easy, but again, it might be useful so I'm just dropping the links here.
None of these solutions worked for me. I changed the colors of my tabs as follows:
This is in the themes.xml
<style name="MyApp" parent="android:style/Theme.Holo">
<item name="android:actionBarTabTextStyle">#style/MyApp.ActionBar.MyTabStyle</item>
</style>
This is in styles.xml
<style name="MyApp.ActionBar.MyTabStyle" parent="android:style/Widget.Holo.ActionBarView_TabText">
<item name="android:textColor">#00ff00</item>
</style>
This should make your tabs green.
I think that you can use:
<resources>
<style name="MyTheme" parent="android:style/Theme.Holo.Light">
<item name="android:actionMenuTextColor">#color/...</item>
</style>
</resources>
Regards

Changing android search dialog text color

I styled my App using a theme as described here.
<style name="MyThemeNameHere" parent="#android:style/Theme.NoTitleBar">
<item name="android:windowBackground">#drawable/background</item>
<item name="android:textColor">#eee</item>
<style>
It works like a charm in most of the App. The background is pretty dark while the text color is bright and text looks good and is easy to read.
Now in the search dialog that android creates for me the background is white, but the text color picks up my style and gets very bright and thus extremely hard to read. I tried also setting android:background to a dark color - This fixed the problem in the search dialog, but caused all textview, etc to get a dark background rather than transparent.
I want to either set the the color or the background only on the search dialog. How do I do this?
As pointed out by Mark Philip the solution can be found in this question:
Android Styling/Theming of just Search Dialog
Basically it should be styled like so
<style name="master" paret="#android:style/Theme.NoTitleBar">
<item name="android:textColorPrimary">#EEEEEE</item>
<item name="android:textColorSecondary">#EEEEEE</item>
<item name="android:textColorTertiary">#EEEEEE</item>
</style>
The root cause was that I styled the android:textColor which should never be styled.

Categories

Resources