When I disable my spinner it's dispalyed a text with an alpha so texte become a little not visible, my question how I can change this color ? PS : I don't need to change the color of the spinner's texte.
Create a color folder in res and create a color state my_text_color.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/disableColor" android:state_enabled="false"/>
<item android:color="@color/enableColor"/>
</selector>
and your textview look like
<TextView
android:textColor="@color/my_text_color"
In adapter you need to inflate the layout that contain the Textview. Inside your adapter constructor, send the id of textview also
public CustomAdapter(Activity context,int resouceId, int textviewId, List<RowItem> list){
super(context,resouceId,textviewId, list);
flater = context.getLayoutInflater();
}
call it by
CustomAdapter adapter = new CustomAdapter(MainActivity.this,
R.layout.listitems_layout, R.id.title, rowItems);
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/disabled_color"/>
<item android:color="@color/normal_color"/>
</selector>
<EditText
android:id="@+id/customEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Hello!"
android:textColor="@drawable/edit_text_selector" />
// first code used in drawable/edit_text_selector.xml
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