vendredi 27 mars 2015

Dynamic checkbox generation in android

I need to generate two reference checkboxes(that i put already in the xml given below) for two different objects.one checkbox reference(from one checkbox can generate based on the number of objects) is worked fine but for the second checkbox it is showing right to the first one...Using that single refrence(id given for a checkbox) i can create a lot of checkboxes dynamically...it is also working fine....but the second checkboxes must have to show under the first one's created...but it is showing right side to the screen and right side to first ones.Can anyone please help.....



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#4D000000"
>
<TableRow
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal">

<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="CheckBox" />
</TableRow>

<TableRow
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal">
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="CheckBox" />
</TableRow>
</LinearLayout>




Aucun commentaire:

Enregistrer un commentaire