Solution for button Event Click Conflict Problem in Android ListView

Source: Internet
Author: User

Today, when setting up a ListView custom adapter, clicking on item has a click Effect and then clicking on a button in the item layout file also triggers the Click Effect of the ListView.

Solutions are:

1. Add in the adapter layout file

<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "@drawable/common_strip_setting_middle"android:descendantfocusability= "Blocksdescendants"android:orientation= "Horizontal" ></LinearLayout>

2. Add in ImageButton

Android:focusable= "false"
< ImageButton                 Android:layout_width = "25DP"                 android:layout_height= "25DP"                android:layout_marginleft= "10DP"                 android:background= "@drawable/calling_btn"                android:contentdescription  = "@string/empty"                android:focusable= "false"/>

Solution for button Event Click Conflict Problem in Android ListView

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.