Android 对话框内部ListView中ListItem的不可选择部分
我正在经历一些奇怪的事情。我有一个listview和适配器,见下图。 单击该项目时,请参见下图。 我希望当我单击listview的右侧部分时,会发生一些事情,[我的McClickListener函数将被调用],但不幸的是,它没有。这很奇怪。是因为我将listview放在对话框中吗? 下面是我的对话框的布局Android 对话框内部ListView中ListItem的不可选择部分,android,android-listview,Android,Android Listview,我正在经历一些奇怪的事情。我有一个listview和适配器,见下图。 单击该项目时,请参见下图。 我希望当我单击listview的右侧部分时,会发生一些事情,[我的McClickListener函数将被调用],但不幸的是,它没有。这很奇怪。是因为我将listview放在对话框中吗? 下面是我的对话框的布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FFFFFF" >
</ListView>
</LinearLayout>
这是我对每个项目的布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/tvSelect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:padding="5dp" />
</LinearLayout>
希望你能帮助我。谢谢。试试这个解决方案。我想,它解决了你的问题 将listview
android:layout\u width=“wrap\u content”
更改为android:layout\u width=“match\u parent”
,并将其更改为LinearLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listSelect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF" >
</ListView>
如果是工作,那么接受这个答案并投票表决,然后它也会帮助其他人。