Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 将ListView项拆分为两列_Android_Listview_Android Listview - Fatal编程技术网

Android 将ListView项拆分为两列

Android 将ListView项拆分为两列,android,listview,android-listview,Android,Listview,Android Listview,我想在ListView中拆分一个项目,以获得与三星联系人电话列表中ListView相同的结果: 单击左/右列时,只有该列的背景更改。我尝试将一个图像按钮插入到一列列表视图中,但如果不直接单击该按钮,整行的背景会发生变化(包括ImageButton的背景) 如何获得与三星相同的列表视图?我使用了这段代码,它对我很有用 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:la

我想在ListView中拆分一个项目,以获得与三星联系人电话列表中ListView相同的结果:

单击左/右列时,只有该列的背景更改。我尝试将一个图像按钮插入到一列列表视图中,但如果不直接单击该按钮,整行的背景会发生变化(包括ImageButton的背景)


如何获得与三星相同的列表视图?

我使用了这段代码,它对我很有用

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:weightSum="3" >

    <Button
        android:id="@+id/text"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:drawableRight="@drawable/ic_launcher"
        android:gravity="center_vertical"
        android:text="trtrtrt" />

    <ImageButton
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />

</LinearLayout>

在列表的xml中使用
android:listSelector=“@null”
,如果它不起作用,那么如果您可以发布它,我想查看一下您的代码