Search code examples
androidlistenerandroid-edittextcustom-lists

Custom list: EditText consumes list's OnItemClickListener


I've been implementing a number of custom-lists, all worked fine. Now I'm trying to add an EditText to the list's rows. The rows look like that:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView android:id="@+id/tv_quest_listrow_categorical_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="blabla"
        android:paddingLeft="10dp"
        android:minHeight="48dp"
        android:gravity="center_vertical" />
    <EditText android:id="@+id/tv_quest_listrow_text"
        android:layout_width="60dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="10dp"
        android:gravity="right|center_vertical"
        android:singleLine="true"
        android:enabled="false"
        android:imeOptions="actionDone" />

</RelativeLayout>

When constructing the list I set an ItemClickListener for the list with listView.setOnItemClickListener(onItemClick);. This used to work fine but fails as soon as there is an EditText in the list rows.

Does anyone have a hint on how to do this?

Regards,
Steff


Solution

  • I found this page, which has some good information on it. Apparently others have had this issue as well.