Bonjour,
Je suis actuellement en train de développer une application.
Une de mes Activity doit afficher une liste d'objets (avec images et description récupérées sur internet).
Je me suis donc tourné vers ce tutoriel : http://android-developers.blogspot.c...rformance.html Code source dispo ici : http://code.google.com/p/android-imagedownloader/
Tout fonctionne très bien, mais sur cet exemple, il n'y a qu'une imageView par ligne.
Et j'aimerai pouvoir y placer deux textView en plus de l'image.
Le xml correspondant à l'activité principale est : liste_produits_activity.xml
Et le xml correspondant à un item de la liste à ça : list_item_product.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"> <brico.fr.ActionBarView android:id="@+id/actionbar" android:layout_width="fill_parent" android:layout_height="wrap_content"> </brico.fr.ActionBarView> <ListView android:id="@+id/liste_produits" android:layout_width="fill_parent" android:layout_height="fill_parent"></ListView> </LinearLayout>
Ma question :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:padding="10dip" android:id="@+id/image"/> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="1" android:paddingLeft="10dip"> <TextView android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textSize="16px" android:textStyle="bold" /> <TextView android:id="@+id/description" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> </LinearLayout>
Où faut-t-il faire référence à ces champs ( R.id.image, R.id.name, R.id.description) ?
Dans le tuto, il ne fait jamais référence à l'imageView, car il n'y a qu'elle dans la ListView, alors comment y remédier ?
Dans la méthode getView() de l'ImageAdapter ?
Merci d'avance![]()
Partager