Android 并非整个列表项都可以在ListView中单击

Android 并非整个列表项都可以在ListView中单击,android,android-listview,Android,Android Listview,是的,我读了这个问题。不,没用 问题是,只有我的ListView单元格的突出显示区域是可单击的。它是用文本填充的区域。请看图片: 因此,当你点击圆圈区域时,它不会响应 关于如何使它正常工作有什么想法吗 编辑:我的列表布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layo

是的,我读了这个问题。不,没用

问题是,只有我的ListView单元格的突出显示区域是可单击的。它是用文本填充的区域。请看图片:

因此,当你点击圆圈区域时,它不会响应

关于如何使它正常工作有什么想法吗

编辑:我的列表布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5dp">

    <ImageView
        android:id="@+id/shoulderLogo"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="5dp">
    </ImageView>

    <TextView
        android:id="@+id/shoulderLabel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </TextView>

</LinearLayout>
试着换成这个

<?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:padding="5dp">

<ImageView
    android:id="@+id/shoulderLogo"
    android:layout_width="wrap_content"
    android:layout_height="100dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="20dp"
    android:layout_marginTop="5dp">
</ImageView>

<TextView
    android:id="@+id/shoulderLabel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</TextView>
试着换成这个

<?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:padding="5dp">

<ImageView
    android:id="@+id/shoulderLogo"
    android:layout_width="wrap_content"
    android:layout_height="100dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="20dp"
    android:layout_marginTop="5dp">
</ImageView>

<TextView
    android:id="@+id/shoulderLabel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</TextView>

我很确定这是因为列表布局LinearLayout的布局宽度为包裹内容。这将导致行的宽度与其中包含的视图的宽度相同。如果改为将其设置为“填充父项”或“匹配父项”,它将扩展以填充列表的宽度。

我很确定这是因为列表布局线性布局的布局宽度为“包裹内容”。这将导致行的宽度与其中包含的视图的宽度相同。如果改为将其设置为“填充父项”或“匹配父项”,则它将扩展以填充列表的宽度。

能否显示为每个列表项膨胀的布局?这是图像还是使用自定义适配器?您介意发布xml布局吗?如果您没有扩大布局,请尝试删除xml文件中的边距。如果有,请查看编辑。它有帮助吗?甚至listview xml文件也会有帮助,我想你能展示一下你为每个列表项膨胀的布局吗?这是一个图像还是你在使用自定义适配器之类的东西?您介意发布xml布局吗?如果您没有扩大布局,请尝试删除xml文件中的边距。如果有,请查看编辑。它有帮助吗?甚至listview xml文件也会有帮助,我想谢谢,它能工作!:但是在ImageView中更改android:layout_width=100dp:谢谢,它可以工作!:但是在ImageView中更改android:layout_width=100dp:如果在textView旁边有一个ImageView怎么办?那你的父母不负责那件事!如果文本视图旁边有一个ImageView怎么办?那你的父母不负责那件事!