Reputation: 1746
I am having a problem with the styling on older devices when using the new v7 Action bar compatibility library. All the styling is messed up, for example I am using list navigation and the spinner that controls the navigation has the circle from the the default spinner
this is what it looks like on API 10:
Whereas this is what it looks like on API 17:
How do I get the styles to match?
Upvotes: 1
Views: 355
Reputation: 2427
I have been dealing with this problem too. The documentation is not very clear on how to keep the List Navigation Mode backward compatible using the appcompat library. This is how you are supposed to initialize it:
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
getSupportActionBar().getThemedContext(), R.array.my_list_of_items,
R.layout.support_simple_spinner_dropdown_item);
getSupportActionBar().setListNavigationCallbacks(adapter, this);
Notice I used getSupportActionBar().getThemedContext() to get the appropriate styling. But that is not enough. You also need to use the correct support layout:
Only then you can get rid of the radio button image on Android versions prior to Honeycomb.
Upvotes: 1
Reputation: 1746
ok I found it, I had to use setDropDownViewResource() on the array adapter that I was passing to the actionbar. This allowed me to set a custom layout. The problem was it was using a CheckedTextView and that's where that circular drawable was coming from. I just pass it a textview and it works fine.
Upvotes: 0