当我禁用我的旋转器时,它会显示一个带有alpha的文本,因此文本变得不太可见。我的问题是如何更改这个颜色?
PS:我不需要更改旋转器文本的颜色。
<?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>
而你的文本视图看起来像
<TextView
android:textColor="@color/my_text_color"
在适配器中,您需要填充包含TextView的布局。 在适配器构造函数中,同时发送TextView的ID。
public CustomAdapter(Activity context,int resouceId, int textviewId, List<RowItem> list){
super(context,resouceId,textviewId, list);
flater = context.getLayoutInflater();
}
称之为
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" />
//在drawable/edit_text_selector.xml中使用的第一段代码