Text font color in dropdown items is still wrong in Light.DarkActionBar
I'm using Theme.Sherlock.Light.DarkActionBar in my project, along with a spinner in my Action Bar with elements of R.layout.sherlock_spinner_item.
However, the text color is still the normal Holo Dark black. This is like #223, but it only applies to Light.DarkActionBar.
(Also, could you add a sherlock_spinner_dropdown_item? It would be much appreciated.)
This is sort of a platform bug, actually. I noticed before the RC but chose to hold off on fixing it.
Basically what happens is the layout pulls the primary text color from the theme to use in the selected spinner view. On a dark theme the primary color is light and on a light theme the primary color is dark. As you said, the problem arises when you use light/dark because the theme is based on the light theme making the primary text color dark. Since the action bar is explicitly set dark, though, we get the black text on dark gray background.
The solution here is to provide your own spinner layout for the selected item which forces the use of a text appearance with a light text color. Since I imagine a lot of people will be having similar problems, I'll provide a sherlock_spinner_item_light_dark or something to save people the trouble.
Why did you want the sherlock_spinner_dropdown_item? I thought the built-in one worked fine on all the platforms I tested.
The dark spinner item would be nice, thanks. At least for me, the built-in dropdown spinner item has the same color problem as the built-in spinner item. I could create my own, but I'm too lazy ;)
http://code.google.com/p/android/issues/detail?id=25624
You can remove your fix for that. This isn't a bug, it's using the wrong context. Using getSupportActionBar().getThemedContext() when creating the adapter solves it for me (tested on ics, gingebread and froyo).
Great catch! I always forget about the themed context.
Just tested it for the normal Holo.Light theme. You can also remove sherlock_spinner_dropdown_item and sherlock_spinner_item (commit was b744d1f/issue 223). Using the simple_spinner_item together with the themed context works fine.
This was the code I used:
ArrayAdapter
On 2.3.4 it shows up incorrectly on pre-3.0 using the native layouts.

Shit, shit, shit...getSupportActionBar().getThemedContext() doesn't work for me.. :( Ahhh what can I do? I searched the whole day for the solution and my app is already online. I'm getting the first negative reviews from people who had this bug.
public class DetailSearchActivity extends SherlockFragmentActivity { [...] public void onCreate(Bundle savedInstanceState) { [...] adapter_level = new BaseDataAdapter(getSupportActionBar().getThemedContext(), android.R.layout.simple_spinner_item, levelLst);
http://tinyurl.com/98kd57n <- here is the actual spinner style on android 2.2
I did not customisations - i'm just using the "Theme.Sherlock" theme..
Use R.layout.sherlock_spinner_item.
It won't work :(
Is this really fixed?
I am simply creating menu items (on the onPrepareOptionsMenu) and I can't change the style of the dropdown items with anything. I've tried like 10 different styling solutions but the menu shown is always with dark background and the app's default text color (which is dark grey and screws everything up).
This sample seems to be when you're creating a navigation spinner and not a menu spinner (the automatically generated when there's no space).
If this is not the same issue, could someone please point me in the right direction? Thanks
@Draiken, have you found a solution? I am stuck with the very same problem. Thanks!
@fbernhard yes, I have finally found it.
The style I successfully used is android:itemTextAppearance. I linked to a style that changed the textColor and voila!
@Draiken perfect, thanks a lot, this works nicely!
@Draiken I have just realized that this also changes the text color in the "long press context menu". I.e. your solutions solves the navigation spinner problem (it is now white font on dark background) but creates a new one for context menues (white font on white background). ;-(
@fbernhard Hmm, I wondered if that changed something else too (name is pretty generic), but I only managed to fix that color with this style, fortunately for me I'm not affected by context menus.
You can probably change the background in the context menus, but it's not always a viable solution.
I just want to chime in on this thread and say that the only thing that worked for me in the end (testing between 2.3.7 and 4.2.2) was using getSupportActionBarContext() instead of getSupportActionBar().getThemedContext().
Example:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
ArrayAdapter
I'm experiencing this issue when extendind the Light.DarkActionBar theme, running in API 9. Both background and text dark.
rafeltoledo, not much anyone is going to be able to help you with when you don't post any code you've tried. Which context are you using? Though, I also wouldn't know from personal experience at all since our lowest supported api on all our apps is 10. You'd only be getting an additional 0.1% of the market by supporting api 9: http://developer.android.com/about/dashboards/index.html
Is it worth it for your app?
Though, I completely understand if dropping support of api 9 isn't an option for you, sometimes it just isn't. You may have to do something specific for that api only even. Best of luck.