Android: Fix Spinner and Item theme when using ActionBarSherlock

Well this was certainly an interesting side-effect of using themes. I had a little trouble getting the themes to look "right". It had to do with the way that the adapter was being created.

before before-items

Use the snippet below to fix the problem. It's the middle line's magic which solved the theming issue for me.

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
dropEventType.setAdapter(adapter);

And there you have it, a nice default-style selection!

after

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog