简体   繁体   中英

Android ListView onItemClickListener does not work on non-clickable EditText

I got a ListView contains an ImageView and an EditText for each row. Both of them are non-clickable, but the onItemClick only work on ImageView, but not the EditText. Please help.

The following is the row of ListView:

    <ImageView
        android:id="@+id/img_item_info"
        android:cursorVisible="false"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:layout_width="@dimen/icon_32"
        android:layout_height="@dimen/icon_32" />

   <EditText
        android:id="@+id/edt_browser_item"
        android:singleLine="true"
        android:background="@drawable/browser_textview_style"
        android:layout_marginLeft="@dimen/margin_between_image_textview"
        android:inputType="none"
        android:scrollHorizontally="true"
        android:cursorVisible="false"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    </EditText>
</LinearLayout>

Best regards,

Antony

android:focusable="true"
android:focusableInTouchMode="true"

on both of the views (Imageview and edittext)

Now you can able to select the imageview and edit the edittext.

Why do you use EditText and trying to block it? Just use TextView if you want to get unclickable EditText.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM