Neither of these are possible answers when your ListView is compromised of a layout that has multiple views. You need to set your child views to:
android:duplicateParentState="true"
Now you can use the methods others have described above to declare your TextViews' colors using a selector such as:
android:textColor="@drawable/my_row_selector"
and I'm sure you're aware, but the selector can be as simple as:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="@color/white" />
<item android:color="@color/black" />
</selector>
As you can see, @color values are allowed. Hope this helps.
Also - android:state_pressed is used in conjunction with the AdapterView.OnItemClickListener.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…