AppCompat v21 Spinner Styles

I just brought AppCompat v20 to API 21 along with AppCompat v21. Most of the time there were no problems and this article helped: https://chris.banes.me/2014/10/17/appcompat-v21/ I have more views looking OK except for Spinners. My app theme:

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">

      

I have no custom styles defined for spinners. I also don't have specific layouts, I add spinners programmatically to the views. Here's a screenshot of what it looks like: enter image description here

I also have MinSdkVersion set to 15. Some styles are obviously related to the new Material theme, like the dark line EditText, but my own text style for labels and text seems to be the same as it does, so it will carry over OK. What can I do to make my spinner look like the rest of the theme? It seems like something in AppCompat v21 thinks I'm on Dark when My theme is light.

+3


source to share


1 answer


I've fixed this so far, until API 21 AppCompat and Support Library get more blurry. What you need to do is create a xml layout for your counter: Then in your code:

final View spinView = inflate(context, R.layout.mult_choice, null);
spin = (Spinner) spinView.findViewById(R.id.mult_choice_spinner);
addView(spin);

      



And it will collect the correct styles from your theme.

0


source







All Articles