0

我正在创建一个应用程序,其中我使用自定义行布局在 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 行的上方内容时,它只执行单击事件,但我想要的是当我单击一行中的任何位置时,应该执行单击操作。但它的行为并非如此。

4

1 回答 1

0

您的行的 XML 应该具有该属性

android:layout_width="fill_parent"
于 2012-06-29T10:31:27.633 回答