标签:
ListView item中有Button和RadioButton的时候,它的Item点击事件不起作用,需要设置item的属性。
android:descendantFocusability="blocksDescendants"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
Here is an example: listview_item.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="10dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:gravity="center_vertical" android:orientation="vertical" android:descendantFocusability="blocksDescendants"> <RadioButton android:id="@+id/script_name_radio_btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textStyle="bold" android:textColor="#000" android:padding="5dp" android:clickable="false" android:focusable="false" android:focusableInTouchMode="false" /> </LinearLayout>
Android ListView onItemClick Not Work
标签:
原文地址:http://www.cnblogs.com/CentForever/p/5267941.html