I have a problem of using selector that it does not work as what I expect. I wanna click on it then it gives me reaction and I select it(By long click but I probably do it through programmatic way) then it gives me another reaction. However, it reacts nothing in result....
reaction part:
<TableRow android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="10" android:padding="5dp" android:background="@drawable/border_bottom" > <LinearLayout android:layout_weight="9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable/selector_row"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/grey" android:text="@string/tel"/> <TextView android:id="@+id/telText" android:layout_width="wrap_content" android:textSize="18sp" android:layout_height="wrap_content" android:text="@string/blank"/> </LinearLayout> <ImageButton android:layout_weight="1" android:id="@+id/tel_call" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:src="@drawable/ic_action_call" android:background="@drawable/border_left"/> </TableRow> selector_row.xml:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" android:drawable="@color/semitransparent_grey"></item> <item android:state_selected="true" android:drawable="@color/semitransparent_blue"></item> <item android:drawable="@color/transparent"></item> </selector>