zoukankan      html  css  js  c++  java
  • Android ListView onItemClick Not Work

    Android ListView onItemClick Not Work

      ListView item中有Button和RadioButton的时候,它的Item点击事件不起作用,需要设置item的属性。

    1. set the root layout with: android:descendantFocusability="blocksDescendants"
    2. set any focusable or clickable view in this item with:
      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>
  • 相关阅读:
    CSS之margin属性完美详解
    CSS2.0中最常用的18条技巧
    CSS之margin属性完美详解
    borderstyle
    CSS2.0中最常用的18条技巧
    CSS2.0中最常用的18条技巧
    CSS之margin属性完美详解
    CSS之margin属性完美详解
    CSS2.0中最常用的18条技巧
    CSS之margin属性完美详解
  • 原文地址:https://www.cnblogs.com/CentForever/p/5267941.html
Copyright © 2011-2022 走看看