I have a table layout and every row i have a two textview. i want to change the text color of textview when the row is selected. I Also use the selector xml in text color of textview but the color is not changing when the row is selected. Here is the xml
<TableRow
android:id="@+id/row1"
android:onClick="rowClick"
android:focusable="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector" //this selector is use for row when its selected
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/textline"
android:orientation="horizontal" >
<TextView
android:id="@+id/username1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Name "
android:textColor="@drawable/text_selector"
android:gravity="left|center"
android:textSize="16dip"
/>
<TextView
android:id="@+id/userName"
android:layout_width="86dp"
android:layout_height="match_parent"
android:layout_weight="0.27"
android:gravity="right|center"
android:freezesText="true"
android:text=""
android:textSize="16dip"
android:textColor="#c4c0A3" />
</LinearLayout>
</TableRow>
Text_selector xml
<selector xmlns:android="http://ift.tt/nIICcg">
<item android:state_focused="true" android:state_pressed="false" android:color="#ffffff" />
<item android:state_focused="true" android:state_pressed="true" android:color="#ffffff" />
<item android:state_focused="false" android:state_pressed="true" android:color="#ffffff" />
<item android:color="#000000" />
</selector>
No comments:
Post a Comment