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 Dialog et titre


Sujet :

Composants graphiques Android

  1. #1
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2011
    Messages
    584
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Août 2011
    Messages : 584
    Points : 181
    Points
    181
    Par défaut Problème Dialog et titre
    Bonjour,
    je viens poster ici car j'ai un petit problème vec mes Dialog.
    En effet, dans mon application j'affiche quelques fois des Dialog, et tout fonctionne nickel.
    Le problème, c'est que la barre de titre prend trop de place, et ne me sert pas. je l'ai donc enlevé avec le code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    dialogEnigme.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Et la la barre de titre disparait, mais mon affichage est complètement modifié.

    Voici le résultat avec la barre de titre :

    Nom : A1.png
Affichages : 118
Taille : 306,4 Ko
    Et celui sans :
    Nom : A2.png
Affichages : 103
Taille : 351,9 Ko

    Donc si quelqu'un a déjà eut ce problème, j'aimerais bien savoir pourquoi la barre de titre me change l'affichage ?

    Voila le code complet :

    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
    @Override
    	public Dialog onCreateDialog (int id) {
     
    		AlertDialog.Builder builder = new AlertDialog.Builder(this);
    		switch(id) {
    case ENIGME_DIALOG:
    			int idEnigme=2;
    			Bdd bdd = new Bdd(PlateauActivity.this);
    			bdd.open();
    			en = new Enigme();
    			en = bdd.getEnigmeWithId(idEnigme);
     
    			dialogEnigme=new Dialog(this);
    			dialogEnigme.requestWindowFeature(Window.FEATURE_NO_TITLE);
    			dialogEnigme.setContentView(R.layout.enigmdialog);
     
    			//dialogEnigme.setTitle("Énigme niveau " + Util.niveau);
     
    			final TextView question = (TextView) dialogEnigme.findViewById(R.id.question);
    			final Button reponse1=(Button)dialogEnigme.findViewById(R.id.prop1);
    			final Button reponse2=(Button)dialogEnigme.findViewById(R.id.prop2);
    			final Button reponse3=(Button)dialogEnigme.findViewById(R.id.prop3);
    			final TextView reponse=(TextView) dialogEnigme.findViewById(R.id.reponse);
    			final TextView explication = (TextView) dialogEnigme.findViewById(R.id.explication);
     
    			explication.setVisibility(View.INVISIBLE);
    			reponse.setVisibility(View.INVISIBLE);
    			reponse1.setText(""+en.getReponse1());
    			reponse2.setText(""+en.getReponse2());
    			reponse3.setText(""+en.getReponse3());
     
    			question.setText(""+en.getQuestion());
    return dialogenigm;
    }

  2. #2
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2011
    Messages
    584
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Août 2011
    Messages : 584
    Points : 181
    Points
    181
    Par défaut
    J'ai oublié de mettre le XML on dirait, donc le voila :

    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
    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/fondmenu"
        android:theme="@android:style/Theme.NoTitleBar">
     
        <TextView
            android:id="@+id/question"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="22dp"
            android:text="Question"
            android:textAppearance="?android:attr/textAppearanceLarge" />
     
        <Button
            android:id="@+id/prop2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/question"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="15dp"
            android:text="Button2" />
     
     
     
        <TextView
            android:id="@+id/reponse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_below="@+id/prop2"
            android:text="Large Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textStyle="bold" />
     
        <TextView
            android:id="@+id/explication"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/reponse"
            android:layout_centerHorizontal="true"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/Orange"
            android:textStyle="italic" />
     
        <Button
            android:id="@+id/prop1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/prop2"
            android:layout_toLeftOf="@+id/prop2"
            android:text="Button1" />
     
        <Button
            android:id="@+id/prop3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/prop2"
            android:layout_alignBottom="@+id/prop2"
            android:layout_toRightOf="@+id/prop2"
            android:text="Button3" />
     
    </RelativeLayout>
    Si quelqu'un à une réponse, une idée ou autre je suis preneur, parce que je m'arrache les cheveux sur ce problème que je ne comprend pas

  3. #3
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2011
    Messages
    584
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Août 2011
    Messages : 584
    Points : 181
    Points
    181
    Par défaut
    Bon et bien j'en déduit que je suis le seul à avoir ce problème.
    Je vais donc laisser la barre de titre pas très chouette

Discussions similaires

  1. Problème "page sans titre" google
    Par hugo7 dans le forum ASP.NET
    Réponses: 4
    Dernier message: 12/01/2011, 21h08
  2. problème avec le titre
    Par Sarrah64 dans le forum Beamer
    Réponses: 1
    Dernier message: 12/11/2008, 13h25
  3. Problème avec le titre d'une figure
    Par dannhil dans le forum Tableaux - Graphiques - Images - Flottants
    Réponses: 11
    Dernier message: 19/10/2008, 17h21
  4. [DEBUTANT] Problème sur le titre
    Par iceman2001 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 5
    Dernier message: 14/09/2005, 17h43

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