0

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

三星联系人列表

单击左/右列时,仅该列的背景发生变化。我尝试将图像按钮插入一列列表视图,但是当不直接单击按钮时,整行的背景会发生变化(包括 ImageButton 的背景)。

如何获得与三星相同的 ListView?

4

2 回答 2

1

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

<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>
于 2013-11-16T10:50:25.307 回答
0

在列表的 xml 中使用 android:listSelector="@null",如果它不起作用,那么如果你可以发布它,我想看看你的代码。

于 2013-11-16T11:16:03.807 回答