In ExpandableListView I have custom parent row (LinearLayout) which contains row data (in TextView with id=data) andwhen is pressed (state before expanded) I change color of row. How to change color of text when is pressed ? I can in adapter set when is expanded and when is not pressed, but I cannot fetch when is only pressed.
Asked
Active
Viewed 1,296 times
0
-
1create one selector for color and set to text of `TextView` – Shayan Pourvatan Mar 26 '14 at 20:48
-
1if you don't get my meant you can see http://stackoverflow.com/questions/1219312/android-selector-text-color – Shayan Pourvatan Mar 26 '14 at 20:51
1 Answers
0
You can set a selector as background of your LinearLayout
:
Save this in /drawable/list_selector.xml :
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/holo_blue_bright" android:state_pressed="true"/>
<item android:drawable="@android:color/holo_blue_light" android:state_selected="true"/>
<item android:drawable="@android:color/holo_blue_dark" android:state_activated="true"/>
</selector>
And set it as background. Note that you can of course change the color as much as you want ;)

Arnaud
- 509
- 5
- 13