ListView自定义行不可完全单击

时间:2012-06-29 09:33:46

标签: android android-listview

我正在创建一个App,其中我使用自定义行布局显示ListView中数据库的信息,该布局使用SimpleCursorAdapter填充。我还为ListView处理onItemClickListner。

我的自定义行布局如下:

<LinearLayout 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:focusableInTouchMode="true"
android:padding="10dip" >

<ImageView android:id="@+id/imageButtonAccount"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:focusable="false"
    android:src="@drawable/icon_account" />

<TextView
    android:id="@+id/TextViewAccount"
    style="@style/textView_normal_bold_style"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="16dip"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:textSize="@dimen/text_size_large" />
</LinearLayout>

但我有一个问题,其中包括:
当我点击ListView行的上面的内容时,它只执行click事件,但我想要的是当我点击连续的任何位置然后应该执行点击操作。但它的行为并不像这样。

1 个答案:

答案 0 :(得分:0)

您的行的XML应具有属性

android:layout_width="fill_parent"