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 :

Problème avec les layout


Sujet :

Composants graphiques Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2011
    Messages
    15
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2011
    Messages : 15
    Par défaut Problème avec les layout
    Bonjour à tous,
    Je veut faire une calculatrice.
    J'ai un problème avec les layout. Alors tout d'abord voila mon main.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
    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
     
    <?xml version="1.0" encoding="utf-8"?>
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
       	android:layout_width="fill_parent"
       	android:layout_height="fill_parent"
    	android:stretchColumns="0,1,2,3"
    	android:background="@drawable/bg">
     
        <TableRow>
            <EditText
    	    	android:layout_width="fill_parent"
    	    	android:layout_height="wrap_content"
                android:layout_span="4"/>
        </TableRow>
     
        <TableRow>
            <Button 
                android:text="7"/>
            <Button 
                android:text="8"/>
            <Button 
                android:text="9"/>
            <Button 
                android:text="C"/>
        </TableRow>
        <TableRow>
            <Button 
                android:text="4"/>
            <Button 
                android:text="5"/>
            <Button 
                android:text="6"/>
            <Button 
                android:text="="/>
        </TableRow>
        <TableRow>
            <Button 
                android:text="1"/>
            <Button 
                android:text="2"/>
            <Button 
                android:text="3"/>
        </TableRow>
        <TableRow>
            <Button 
                android:text="0"
                android:layout_span="2"/>
            <Button 
                android:text=","/>
        </TableRow>
    </TableLayout>
    Et voici ce qu'il donne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    |---------------|
    |   EditText    |
    |---|---|---|---|
    | 7 | 8 | 9 | C |
    |---|---|---|---|
    | 4 | 5 | 6 | = |
    |---|---|---|---|
    | 1 | 2 | 3 |   |
    |-------|---|---|
    |   0   | , |   |
    |-------|---|---|
    Donc la il y a une calculatrice. Il y a 2 cases vide en bas à droite. Je voudrai que le bouton = prennent leurs place de sorte à ce que ca deviennent

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    |---------------|
    |   EditText    |
    |---|---|---|---|
    | 7 | 8 | 9 | C |
    |---|---|---|---|
    | 4 | 5 | 6 |   |
    |---|---|---|   |
    | 1 | 2 | 3 | = |
    |-------|---|   |
    |   0   | , |   |
    |-------|---|---|
    Mais je ne sais pas comment faire
    Merci d'avance

  2. #2
    Expert confirmé

    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
    Par défaut
    Bonjour,

    C'est pas bon mais ça marche

    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
    55
    56
    57
    58
    59
    60
    61
    62
    63
    <?xml version="1.0" encoding="utf-8"?>
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    	   	android:layout_width="fill_parent"
    	   	android:layout_height="fill_parent"
    		android:stretchColumns="0,1,2,3"
    		>
     
    	    <TableRow>
    	        <EditText
    		    	android:layout_width="fill_parent"
    		    	android:layout_height="wrap_content"
    	            android:layout_span="4"/>
    	    </TableRow>
    	    <TableRow>
    	        <Button 
    	            android:text="7"/>
    	        <Button 
    	            android:text="8"/>
    	        <Button 
    	            android:text="9"/>
    	        <Button 
    	            android:text="C"/>
    	    </TableRow>
    	    <TableRow>
     
    	    	<TableLayout android:layout_width="fill_parent"
    				   	android:layout_height="wrap_content"
    					android:stretchColumns="0,1,2"
    					android:layout_span="3"
    					> 
    				    <TableRow >
    				        <Button 
    				            android:text="4"/>
    				        <Button 
    				            android:text="5"/>
    				        <Button 
    				            android:text="6"/>
    				    </TableRow>
    				    <TableRow >
    				        <Button 
    				            android:text="1"/>
    				        <Button 
    				            android:text="2"/>
    				        <Button 
    				            android:text="3"/>
     
    				    </TableRow>
    				    <TableRow>
    				        <Button 
    				            android:text="0"
    				            android:layout_span="2"/>
    				        <Button 
    				            android:text=","
    				            />
    				    </TableRow>
    			    </TableLayout>
    			    <Button android:text="="
    						android:layout_width="fill_parent"
    				   		android:layout_height="fill_parent"
    				   		android:layout_column="3"
    				    		/>
    		</TableRow>		
    </TableLayout>

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2011
    Messages
    15
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2011
    Messages : 15
    Par défaut
    Merci beaucoup, ca marche

  4. #4
    Expert confirmé

    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
    Par défaut
    Bonjour,

    Si vous pensez que votre post est résolu merci de bien cliquer sur le bouton mise à votre entière disposition .

    Bonne soirée

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

Discussions similaires

  1. Problème affichage avec les Layouts
    Par TWEESTY dans le forum Composants graphiques
    Réponses: 4
    Dernier message: 18/02/2011, 01h01
  2. Problème avec les Groupe layout
    Par LaurineD dans le forum Général Java
    Réponses: 0
    Dernier message: 01/05/2010, 18h03
  3. Problème avec les apostrophes
    Par misterbillyboy dans le forum Requêtes
    Réponses: 2
    Dernier message: 15/07/2003, 16h39
  4. Problème avec les fichiers .JPG
    Par cprogil dans le forum Langage
    Réponses: 5
    Dernier message: 10/06/2003, 15h44
  5. []Problème avec les formulaires Outlook
    Par Invité dans le forum Outlook
    Réponses: 6
    Dernier message: 05/12/2002, 09h59

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