<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText1F"
android:layout_alignTop="@+id/txtLabel1F"
android:entries="@array/cat_array"
android:prompt="@string/cat_promt"
android:textColor="#ffffff"
/>
My Background is black and the item showing is with gray bg and black font color. But when it come to the selected it shows the font as black so it is not being seen. How do I change the color in it?
You need to create a custom spinner layout to achieve what you want.
check out these questions, they have the answers you want:
How to customize a Spinner in Android
Android: Custom Spinner Layout
The idea is to create a layout for your row, and set it when creating a spinner with its adapter in code.
Simplest use this
use this to change the text of selected Text
YOUR_SPINNER.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
TextView selectedText= view.findViewById(R.id.text_view_name_in_Adapter);
selectedText.setTextColor(getResources().getColor(R.color.YOUR_COLOR));
}
}
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