How to change the font color of an Android spinner?
To change the font color of an Android Spinner, you can follow these steps:
- Create a custom Spinner style in res/values/styles.xml.
<style name="SpinnerStyle" parent="@android:style/Widget.Spinner">
<item name="android:textColor">@color/your_color</item>
</style>
- Apply this style in the Spinner layout file (res/layout/your_spinner_layout.xml).
<Spinner
...
android:theme="@style/SpinnerStyle"
/>
- Set the Spinner’s Adapter in the code.
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.your_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
This way, you can set the font color of the Spinner. You can use @color/your_color to set the font color you desire.