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

Android Discussion :

[Débutant]Problème dans main.xml


Sujet :

Android

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2011
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 6
    Points : 6
    Points
    6
    Par défaut [Débutant]Problème dans main.xml
    Bonjour,

    je comme dis dans le titre je suis un débutant dans la programmation android.
    J'ai suivi le tuto pour créer une calculatrice (celui-ci: http://a-renouard.developpez.com/tut.../calculatrice/), mais seul l'editbox s'affiche dans l'application lorsque je lance l'émulateur, les boutons sont invisibles. Je pense que cela vient du main.xml car lorsque je check l'apeçu dans eclipse, il ne m'affiche pas les boutons.

    Voici mon code 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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
     
    <?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"
    >
     
    	<EditText android:id="@+id/EditText01"
    			android:layout_width="fill_parent"
    			android:layout_height="wrap_content"
    			android:textSize="20px"
    			android:editable="false"
    			android:cursorVisible="false"
    	/>
     
    	<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    	>
    		<Button android:id="@+id/bouton1"
    				android:text="1"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/bouton2"
    				android:text="2"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/bouton3"
    				android:text="3"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonPlus"
    				android:text="+"
    				android:layout_height="fill_parent"
    				android:layout_width="wrap_content"
    				android:layout_weight="1"
    		/>
     
    	</LinearLayout>
     
    		<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    		>
    			<Button android:id="@+id/bouton4"
    					android:text="1"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton5"
    					android:text="2"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton6"
    					android:text="3"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/boutonMoins"
    					android:text="+"
    					android:layout_height="fill_parent"
    					android:layout_width="wrap_content"
    					android:layout_weight="1"
    			/>
     
    	</LinearLayout>
     
    		<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    		>
    			<Button android:id="@+id/bouton7"
    					android:text="1"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton8"
    					android:text="2"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton9"
    					android:text="3"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/boutonMultiplier"
    					android:text="+"
    					android:layout_height="fill_parent"
    					android:layout_width="wrap_content"
    					android:layout_weight="1"
    			/>
     
    	</LinearLayout>
     
    	<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    	>
    		<Button android:id="@+id/bouton0"
    				android:text="0"
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonPoint"
    				android:text="."
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonC"
    				android:text="C"
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonDiviser"
    				android:text="/"
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
    	</LinearLayout>
     
    	<Button android:id="@+id/boutonEgal"
    				android:text="="
    				android:layout_width="fill_parent"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    </LinearLayout>
    Quelqu'un aurait une idée de la raison pour laquelle mes boutons ne s'affichent pas ? (je n'ai aucune erreur dans le fichier .java)

  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
    Bonjour,

    Euh , tu as ton premier linear en horizontal alors qu'il devrait être en vertical ?

    Ensuite dans tout tes linear fils tu as toujours le dernier butons avec ces propriété inversé sur la hauteur et largeur

    donc

    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
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
    >
     
    	<EditText android:id="@+id/EditText01"
    			android:layout_width="fill_parent"
    			android:layout_height="wrap_content"
    			android:textSize="20px"
    			android:editable="false"
    			android:cursorVisible="false"
    	/>
     
    	<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    	>
    		<Button android:id="@+id/bouton1"
    				android:text="1"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/bouton2"
    				android:text="2"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/bouton3"
    				android:text="3"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonPlus"
    				android:text="+"
    				android:layout_height="wrap_content"
    				android:layout_width="fill_parent"
    				android:layout_weight="1"
    		/>
     
    	</LinearLayout>
     
    		<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    		>
    			<Button android:id="@+id/bouton4"
    					android:text="1"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton5"
    					android:text="2"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton6"
    					android:text="3"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/boutonMoins"
    					android:text="+"
    					android:layout_height="wrap_content"
    					android:layout_width="fill_parent"
    					android:layout_weight="1"
    			/>
     
    	</LinearLayout>
     
    		<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    		>
    			<Button android:id="@+id/bouton7"
    					android:text="1"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton8"
    					android:text="2"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/bouton9"
    					android:text="3"
    					android:layout_width="fill_parent"
    					android:layout_height="wrap_content"
    					android:layout_weight="1"
    			/>
     
    			<Button android:id="@+id/boutonMultiplier"
    					android:text="+"
    					android:layout_height="wrap_content"
    					android:layout_width="fill_parent"
    					android:layout_weight="1"
    			/>
     
    	</LinearLayout>
     
    	<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    				android:orientation="horizontal"
    				android:layout_width="fill_parent"
    				android:layout_height="wrap_content"
    	>
    		<Button android:id="@+id/bouton0"
    				android:text="0"
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonPoint"
    				android:text="."
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonC"
    				android:text="C"
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    		<Button android:id="@+id/boutonDiviser"
    				android:text="/"
    				android:layout_width="wrap_content"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
    	</LinearLayout>
     
    	<Button android:id="@+id/boutonEgal"
    				android:text="="
    				android:layout_width="fill_parent"
    				android:layout_height="fill_parent"
    				android:layout_weight="1"
    		/>
     
    </LinearLayout>
    Responsable Android de Developpez.com (Twitter et Facebook)
    Besoin d"un article/tutoriel/cours sur Android, consulter la page cours
    N'hésitez pas à consulter la FAQ Android et à poser vos questions sur les forums d'entraide mobile d'Android.

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2011
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 6
    Points : 6
    Points
    6
    Par défaut
    Merci beaucoup pour ta réponse, le problème est résolu ^^

  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
    Merci de cliquer sur le bouton lorsque vous pensez que quelqu'un a répondu à votre question .

    Merci .
    Responsable Android de Developpez.com (Twitter et Facebook)
    Besoin d"un article/tutoriel/cours sur Android, consulter la page cours
    N'hésitez pas à consulter la FAQ Android et à poser vos questions sur les forums d'entraide mobile d'Android.

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

Discussions similaires

  1. [Débutant] Problème dans ma subroutine
    Par salseropom dans le forum Fortran
    Réponses: 3
    Dernier message: 22/10/2007, 15h46
  2. [Débutant] Erreur dans server.xml
    Par Mathieu.J dans le forum JDeveloper
    Réponses: 6
    Dernier message: 11/06/2007, 11h46
  3. [Débutant] Problème dans une boucle Matlab
    Par RaphTIM dans le forum MATLAB
    Réponses: 3
    Dernier message: 05/06/2007, 18h51
  4. [débutant] problème dans le cours de S.Tahe
    Par olivier57b dans le forum Servlets/JSP
    Réponses: 17
    Dernier message: 19/02/2007, 13h56
  5. [Débutant] Probléme dans applet
    Par brionne dans le forum Applets
    Réponses: 1
    Dernier message: 29/08/2005, 11h53

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