DaProd Posted February 4, 2011 Share Posted February 4, 2011 Bonjour, Je suis nouveau dans la programmation Android, venant de la programmation iPhone, certaines notions de bases ne me sont pas familières, veuillez donc m'excuser si mes questions sont vraiment "bêtes". J'aimerai créer une ListView qui ne prenne pas la taille totale de l'écran, pour cela dois-je créer un layout d'une dimension donnée et la mettre dedans ? Comment cela fonctionne pour que le rendu soit valable pour toute résolution d'écran ? Merci à vous, et soyez indulgent :P Link to comment Share on other sites More sharing options...
olboss Posted February 4, 2011 Share Posted February 4, 2011 Change dans le xml la hauteur de ta ListView, mais pas "fill_parent" met la hauteur que tu veux Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2011 Share Posted February 15, 2011 Ou alors, si tu ne veux pas spécifier le taille pour ne pas avoir de problèmes avec les différents écrans, tu peux simplement ajouter : android:layout_weight="1" dans la liste des spécifications xml de ta ListView: Par exemple, si tu veux mettre une ListView entre deux bandeaux de texte, voici le code: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp" android:gravity="center" android:background="#FFF" android:textColor="#046380" android:textSize="20dp" android:text="Bandeau supérieur :"/> <ListView android:id="@+id/list_cities" android:layout_width="fill_parent" android:layout_height="fill_parent" android:cacheColorHint="#FFF" android:layout_margin="5dp"> </ListView> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp" android:gravity="center" android:background="#FFF" android:textColor="#046380" android:textSize="20dp" android:text="Bandeau inférieur :"/> </LinearLayout> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.