Android ListView, when Focusable items, disables clicks

I use ListView with a custom adapter, it just has one TextView

<TextView
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/list_item_content"
   android:background="@drawable/list_item1"
   android:layout_width="fill_parent" android:layout_height=""wrap_content"

 />

Here is my selector background:

<selector 
 xmlns:android="http://schemas.android.com/apk/res/android">    

<item android:state_focused="true" android:state_enabled="false"
    android:state_pressed="true"
    android:drawable="@drawable/draw_list_item1" />
<item android:state_focused="true" android:state_enabled="false"
    android:drawable="@drawable/draw_list_item_focused" />

<item android:state_focused="true" android:state_pressed="true"
    android:drawable="@drawable/draw_list_item_selected" />
<item android:state_focused="false" android:state_pressed="true"
    android:drawable="@drawable/draw_list_item_selected" />

<item android:state_focused="true"
    android:drawable="@drawable/draw_list_item_focused" />

<item android:drawable="@drawable/draw_list_item1"/>

</selector>

The problem is that I set the properties TextView: android:clickable="true"andandroid:focusable="true"

It is then that I see my focal version of the background image, but the installation of these elements of the list of reasons no longer responds to clicks and long clicks. When these 2 properties are deleted, all ListItems objects respond to clicks and long clicks.

What you need to do to make the focal background visible and click, reacts like a job.

I tried to call getListView().setItemsCanFocus(true), but problems still persist.

+5
1

android: focusable, TextView

android:duplicateParentState="true"

.

+3

All Articles