listview條目長按問題

listview的條目


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:gravity="center"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="@dimen/y140"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<ImageView
android:id="@+id/iv_header"
android:layout_width="@dimen/x100"
android:layout_height="@dimen/y100"

/>

<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="@dimen/y40"
android:layout_weight="1"
android:text="ss"
android:gravity="center"
style="@style/table_content_textview"
/>

</LinearLayout>



<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
>

<CheckBox
android:id="@+id/ckb_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:button="@null"
android:drawableLeft="@drawable/btn_check_selector"
android:clickable="false"
android:focusable="false"
android:enabled="false"
android:longClickable="true" //listview長按需要加上longClickable="true" 可以不搶佔焦點
android:padding="0px"
/>

</LinearLayout>

</LinearLayout>
發佈了31 篇原創文章 · 獲贊 15 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章