I have a listview element as below
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:descendantFocusability="blocksDescendants"
>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/music_list_item_checkbox_bg"
/>
</LinearLayout>
music_list_item_checkbox_bg.xml - This is a selector that will display various available depending on another state.
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:state_pressed="false"
android:state_selected="true"
android:drawable="@drawable/btn_checkbox_check_untapped" />
<item android:state_selected="true"
android:state_pressed="true"
android:drawable="@drawable/btn_checkbox_check_tapped" />
<item android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/btn_checkbox_uncheck_untapped" />
<item android:state_selected="false"
android:state_pressed="true"
android:drawable="@drawable/btn_checkbox_uncheck_tapped" />
</selector>
When I clicked an item in the list and left the touch screen inside the item, then depending on the other state, you can use it.
Question . But if I pressed an element and pulled my finger horizontally out of the object (the touch point X is between the upper and lower parts of the element), then exit the screen, the ejected flag will remain in the pressed state. (If the touch point X is outside the top and bottom of the element, the state is correct).
android:duplicateParentState="true" , , .
, - ?
Edited
onTouch onIntercept , , super.onTouch( MotionEvent). true, , onItemClick . onTouch AbsListview, , , , child (item) false, child.setPressed(false), .
!!!