I'm using android databinding and as part of that, I have a spinner with items (array declared in strings.xml) as
android:entries="@string/items"
Now I would like to change the text color and size of the dropdown items. I want to do this with out creating a separate layout for item and using it through java (passing the item layout to array adapter and setting that adapter to the spinner).
I tried many ways and searched everywhere but didn't find appropriate solution.
Any help is appreciated.
You should use android.support.v7.widget.AppCompatSpinner.
<android.support.v7.widget.AppCompatSpinner
style="@style/Widget.AppCompat.Spinner.Underlined"
android:theme="@style/Spinner"
android:entries="@array/special_fx_arrays"
android:textSize="@dimen/text_size_normal"/>
Here the style to put in styles.xml
<style name="Spinner" parent="Widget.AppCompat.Light.DropDownItem.Spinner">
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">0dp</item>
<item name="android:textColor">@color/white</item>
<item name="android:backgroundTint">@color/red</item>
<item name="android:textSize">14sp</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With