Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.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中的多个复选框_Android - Fatal编程技术网

Android中的多个复选框

Android中的多个复选框,android,Android,我正在android中设计联系人列表页面,其中有一个图像框,然后是姓名和复选框。当我选择屏幕上显示的所有联系人并向下滚动以便进一步选择联系人时,我在上一页中选择的联系人将自动取消选中。 这是我的XML代码 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap

我正在android中设计联系人列表页面,其中有一个图像框,然后是姓名和复选框。当我选择屏幕上显示的所有联系人并向下滚动以便进一步选择联系人时,我在上一页中选择的联系人将自动取消选中。 这是我的XML代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:divider="?android:dividerVertical"
    android:dividerPadding="8dp"
    android:minHeight="?android:listPreferredItemHeight"
    android:orientation="horizontal"
    android:showDividers="middle">


    <ImageButton
        android:id="@+id/image"
        android:layout_width="@dimen/contact_image"
        android:layout_height="match_parent"
        android:src="@drawable/ic_action_user"/>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:clickable="false"
        android:focusable="true"
        android:gravity="center_vertical"
        android:orientation="vertical">

        <TextView
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="15sp"
            android:text="@string/dummy_title"  />


    </LinearLayout>

    <CheckBox
        android:layout_width="@dimen/standard_touch_target_size"
        android:layout_height="match_parent"
        android:clickable="true"
        android:gravity="center"
        android:paddingLeft="50dp"/>




</LinearLayout>


能否提供其余的代码,如适配器?您是否正在为所选职位设置所选状态?这可能就是您总是会出现未选中复选框的原因。

因此,您希望在回滚时保留上一个项目的选中状态吗?是,我想要上一个status@Leog