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 :

Pas moyen d'avoir une valeur autre que "wrap_content"


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre émérite
    Avatar de ChPr
    Homme Profil pro
    Inscrit en
    Septembre 2005
    Messages
    2 122
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 79
    Localisation : France, Val d'Oise (Île de France)

    Informations forums :
    Inscription : Septembre 2005
    Messages : 2 122
    Par défaut Pas moyen d'avoir une valeur autre que "wrap_content"
    Bonjour à toutes et à tous,

    Je crée une petite application munie de layout horizontaux contenant chacun un TextView et un EditText.

    Dès que je veux remplacer dans un layout ou un TextView ou un EditText la valeur "wrap_content" par une valeur numérique j'obtiens un massage d'erreur tel que :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
     ERROR:E:\StudioProjects\PosSoleil\app\src\main\res\layout\activity_main.xml:23: AAPT: error: '100' is incompatible with attribute layout_width (attr) dimension|enum [fill_parent=4294967295, match_parent=4294967295, wrap_content=4294967294].
    ci après, le contenu de "activity_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
    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
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
     
       <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/affichage"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
     
            <LinearLayout
                android:id="@+id/LayoutDate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:orientation="horizontal">
     
                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Date :" />
     
                <EditText
                    android:id="@+id/editDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:hint="JJ/MM/AAAA"
                    android:inputType="date" />
            </LinearLayout>
     
            <LinearLayout
                android:id="@+id/layoutTime"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/LayoutDate"
                android:orientation="horizontal">
     
                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Heure :" />
     
                <EditText
                    android:id="@+id/editTime"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:hint="HH:MM:SS"
                    android:inputType="time" />
            </LinearLayout>
     
            <LinearLayout
                android:id="@+id/layoutZone"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/layoutTime"
                android:orientation="horizontal">
     
                <TextView
                    android:id="@+id/textView3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Zone horaire :" />
     
                <EditText
                    android:id="@+id/editZoneHoraire"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:inputType="number" />
            </LinearLayout>
     
            <LinearLayout
                android:id="@+id/layoutLatitude"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/layoutZone"
                android:orientation="horizontal">
     
                <TextView
                    android:id="@+id/textView4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Latitude :" />
     
                <EditText
                    android:id="@+id/editLatitude"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:hint="degrés décimaux"
                    android:numeric="signed|decimal" />
            </LinearLayout>
     
            <LinearLayout
                android:id="@+id/layoutLongitude"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/layoutLatitude"
                android:orientation="horizontal">
     
                <TextView
                    android:id="@+id/textView5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Longitude :" />
     
                <EditText
                    android:id="@+id/editLongitude"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:hint="degrés décimaux"
                    android:numeric="signed|decimal" />
            </LinearLayout>
     
            <LinearLayout
                android:id="@+id/layoutCalculer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/layoutLongitude"
                android:orientation="vertical">
     
                <Button
                    android:id="@+id/calculer"
                    android:layout_width="194dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="calculePos"
                    android:text="Calculer" />
            </LinearLayout>
     
            <LinearLayout
                android:id="@+id/layoutElevation"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/layoutCalculer"
                android:orientation="horizontal">
     
                <TextView
                    android:id="@+id/textView6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Elévation :" />
     
                <TextView
                    android:id="@+id/textElevation"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
     
            </LinearLayout>
     
            <LinearLayout
                android:id="@+id/layoutAzimut"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/layoutElevation"
                android:orientation="horizontal">
     
                <TextView
                    android:id="@+id/textView7"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Azimut :" />
     
                <TextView
                    android:id="@+id/textAzimut"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
     
            </LinearLayout>
        </RelativeLayout>
    Je ne comprends pas ce qui ne va pas.

    Merci de votre aide.

    Pierre.

  2. #2
    Membre émérite
    Avatar de ChPr
    Homme Profil pro
    Inscrit en
    Septembre 2005
    Messages
    2 122
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 79
    Localisation : France, Val d'Oise (Île de France)

    Informations forums :
    Inscription : Septembre 2005
    Messages : 2 122
    Par défaut
    Apparemment, mon problème venait du fait que j'entrais de valeurs sans unité. Il faut, par exemple pour des dimensions, écrire 150dp au lieu de 150.

    Pour autant, si ces valeurs numériques sont prises en compte, le résultat est parfois déroutant. Je n'arrive pas bien à comprendre ce qui est prédominant des valeurs numériques des "layout-weight".

    Cordialement.

    Pierre.

Discussions similaires

  1. Définir une valeur autre que "0" pour commencer une numérotation incrémentale
    Par jmbinformatique dans le forum Odoo (ex-OpenERP)
    Réponses: 5
    Dernier message: 04/02/2014, 12h52
  2. comment avoir une valeur d'une form1 dans un autre form
    Par sabrina_beautyful dans le forum Windows Forms
    Réponses: 3
    Dernier message: 18/05/2009, 14h53
  3. avoir une valeur d'un form dans un autre
    Par khansae_drime dans le forum Windows Forms
    Réponses: 1
    Dernier message: 18/05/2009, 09h49
  4. [JFrame] Pas moyen d'avoir une fenetre active
    Par deedji dans le forum Agents de placement/Fenêtres
    Réponses: 3
    Dernier message: 24/05/2004, 16h08

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