IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants graphiques Android Discussion :

Probleme affichage dans layout


Sujet :

Composants graphiques Android

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 46
    Points : 22
    Points
    22
    Par défaut Probleme affichage dans layout
    Bonjour

    à l'interieur d'un LinearLayout je veux deux layout l'un à coté de l'autre, je n'y arrive pas ils s'affichent l'un sous l'autre
    voici mon code :

    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
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    <LinearLayout
      	xmlns:android="http://schemas.android.com/apk/res/android"
      	android:id="@+id/fiche"
      	android:layout_width="fill_parent"
      	android:layout_height="fill_parent"
      	android:orientation="vertical"
      	android:layout_weight="1">
      		<LinearLayout
      		xmlns:android="http://schemas.android.com/apk/res/android"
      		android:id="@+id/texte"
      		android:layout_width="wrap_content"
      		android:layout_height="wrap_content"
      		android:orientation="vertical"
      		android:layout_gravity="Left"
      		android:layout_weight="1">
      			<TextView
      			android:id="@+id/text1"
    			android:layout_width="fill_parent"
    			android:layout_height="wrap_content"
    			android:textSize="12px"
    			android:textColor="#000000"/>
    			<TextView
      			android:id="@+id/text2"
    			android:layout_width="fill_parent"
    			android:layout_height="wrap_content"
    			android:textSize="12px"
    			android:textColor="#000000"/>
       		</LinearLayout>
      		<LinearLayout
      		xmlns:android="http://schemas.android.com/apk/res/android"
      		android:id="@+id/image"
      		android:layout_width="wrap_content"
      		android:layout_height="wrap_content"
      		android:orientation="vertical"
      		android:layout_gravity="right"
      		android:layout_weight="1">
      			<ImageButton
      			android:layout_width="wrap_content"
      			android:layout_height="wrap_content"
       			android:layout_marginBottom="5px"/>
       			<ImageButton
      			android:layout_width="wrap_content"
      			android:layout_height="wrap_content"
       			android:layout_marginBottom="5px"/>
        	</LinearLayout>
     </LinearLayout>
    Pouvez-vous me dire pourquoi

  2. #2
    Expert éminent

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Points : 9 149
    Points
    9 149
    Par défaut
    Salut

    Je te conseille de regarder les paramètre des layout dans la doc d'android .

    pour android:layout_weight cela permet de forcer le layout a prendre tout l'espace possible en fonction des autres éléments présents.

    Les layout gravity servent à définir l'emplacement du layout dans celui du parent .Pour un LinearLayout cela n'est pas utile dans ce cas.



    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
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    <LinearLayout
      	xmlns:android="http://schemas.android.com/apk/res/android"
      	android:id="@+id/fiche"
      	android:layout_width="fill_parent"
      	android:layout_height="fill_parent"
      	android:orientation="vertical"
      	android:layout_weight="1">
      		<LinearLayout
      		xmlns:android="http://schemas.android.com/apk/res/android"
      		android:id="@+id/texte"
      		android:layout_width="fill_parent"
      		android:layout_height="wrap_content"
      		android:orientation="vertical"
      		>
      			<TextView
      			android:id="@+id/text1"
    			android:layout_width="fill_parent"
    			android:layout_height="wrap_content"
    			android:textSize="12px"
    			android:textColor="#000000"/>
    			<TextView
      			android:id="@+id/text2"
    			android:layout_width="fill_parent"
    			android:layout_height="wrap_content"
    			android:textSize="12px"
    			android:textColor="#000000"/>
       		</LinearLayout>
      		<LinearLayout
      		xmlns:android="http://schemas.android.com/apk/res/android"
      		android:id="@+id/image"
      		android:layout_width="fill_parent"
      		android:layout_height="wrap_content"
      		android:orientation="vertical"
      		>
      			<ImageButton
      			android:layout_width="wrap_content"
      			android:layout_height="wrap_content"
       			android:layout_marginBottom="5px"/>
       			<ImageButton
      			android:layout_width="wrap_content"
      			android:layout_height="wrap_content"
       			android:layout_marginBottom="5px"/>
        	</LinearLayout>
     </LinearLayout>

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 46
    Points : 22
    Points
    22
    Par défaut
    Merci pour ta réponse

    Mais les deux layouts texte et images sont l'un en dessous de l'autre
    je voudrais qu'ils soient cote à cote

  4. #4
    Expert éminent

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Points : 9 149
    Points
    9 149
    Par défaut
    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
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    <LinearLayout
      	xmlns:android="http://schemas.android.com/apk/res/android"
      	android:id="@+id/fiche"
      	android:layout_width="fill_parent"
      	android:layout_height="fill_parent"
      	android:orientation="vertical"
      	android:layout_weight="1">
      		<LinearLayout
      		xmlns:android="http://schemas.android.com/apk/res/android"
      		android:id="@+id/texte"
      		android:layout_width="wrap_content"
      		android:layout_height="wrap_content"
      		android:orientation="horizontal"
      		android:layout_marginBottom="5px"
      		>
      			<TextView
      			android:id="@+id/text1"
    			android:layout_width="wrap_content"
    			android:layout_height="wrap_content"
    			android:textSize="12px"
    			android:text="coucou"
    			android:layout_gravity="center"
    			android:textColor="#FFFFFF"/>
    			<ImageButton
      			android:layout_width="wrap_content"
      			android:layout_height="wrap_content"
      			android:layout_gravity="center"
       			/>
     
       		</LinearLayout>
      		<LinearLayout
      		xmlns:android="http://schemas.android.com/apk/res/android"
      		android:id="@+id/image"
      		android:layout_width="wrap_content"
      		android:layout_height="wrap_content"
      		android:orientation="horizontal"
      		android:layout_marginBottom="5px"
      		>
      			<TextView
      			android:id="@+id/text2"
    			android:layout_width="fill_parent"
    			android:layout_height="wrap_content"
    			android:textSize="12px"
    			android:text="coucou"
     
    			android:layout_gravity="center"
    			android:textColor="#FFFFFF"/>
       			<ImageButton
      			android:layout_width="wrap_content"
      			android:layout_height="wrap_content"
      			android:layout_gravity="center"
       			/>
        	</LinearLayout>
     </LinearLayout>

  5. #5
    Membre à l'essai
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 46
    Points : 22
    Points
    22
    Par défaut
    Merci pour on aide, c'est bon

  6. #6
    Expert éminent

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Points : 9 149
    Points
    9 149
    Par défaut
    Si c'est ok pour toi , n'oublie pas de mettre le tag résolu .

    Merci.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [WD14] Probleme affichage dans Zone Répétée
    Par mero007 dans le forum WinDev
    Réponses: 21
    Dernier message: 31/07/2009, 11h28
  2. [MySQL] probleme affichage dans un tableau avec double requetes
    Par roy-mustang dans le forum PHP & Base de données
    Réponses: 9
    Dernier message: 25/05/2009, 09h25
  3. probleme affichage dans internet explorer
    Par cuisto44000 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 6
    Dernier message: 01/09/2008, 13h51
  4. Probleme affichage dans entry a partir d'un fichier texte
    Par HaaRt dans le forum GTK+ avec C & C++
    Réponses: 6
    Dernier message: 06/04/2007, 12h01
  5. Probleme affichage dans tableau selon requête
    Par moulette85 dans le forum Langage SQL
    Réponses: 11
    Dernier message: 01/03/2005, 15h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo