samedi 20 janvier 2018

Check one CheckBox set another uncheck in a Android ListView

listView with dual CheckBox Image

Am new in Android
I have two checkbox in a list I want to check one at time and unable the other one

my main.xml

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

    <TextView
        android:id="@+id/student_name"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:padding="20dp"/>

    <CheckBox
        android:id="@+id/present_check"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="false"
        android:duplicateParentState="false" />

    <CheckBox
        android:id="@+id/absent_check"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>

list.xml

<LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:orientation="vertical">

        <ListView
            android:id="@+id/names_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        </ListView>

    </LinearLayout




Aucun commentaire:

Enregistrer un commentaire