Répéter dynamiquement un layout
Bonjour à tous,
Dans mon application je suis amener à répéter un layout plusieurs fois de façon dynamique en fonction du nombre de résultats que retourne ma base de donnée.
J'ai crée en xml le layout en question:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/de"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Consulter ou modifier la commande"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RelativeLayout
android:id="@+id/dz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/textView2"
android:layout_marginTop="10dp"
android:background="@drawable/layout_bg" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/textView1"
android:padding="10dp"
android:text="TextView" />
</RelativeLayout>
</RelativeLayout> |
http://img15.hostingpics.net/thumbs/...0225141201.png
J'aimerai connaitre la méthode pour afficher plusieurs fois la vue textview. Dois je programmer en java ou est ce que en faisant un inflate du layout je pourrais afficher plusieurs fois dans une boucle ?