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 :

Hauteur barre de titre


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    182
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 182
    Par défaut Hauteur barre de titre
    Boujour

    Je cherche à connaitre la hauteur de la barre de titre de l'application pour centrer mes widgets par rapport à l'espace restant.

    Une idée ?

    merci

  2. #2
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 035
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 035
    Par défaut
    Citation Envoyé par LordDaedalus Voir le message
    Une idée ?
    tu n'utilise pas les layouts?

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    182
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 182
    Par défaut
    Si voila 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
     
    super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
     
            WindowManager wm=(WindowManager)getSystemService(WINDOW_SERVICE);
            Display display= wm.getDefaultDisplay();
            int height = display.getHeight(); 
            int width = display.getWidth(); // pour information
            height = height - 50;
     
            final Button button1 = (Button) findViewById(R.id.Button01); 
            button1.setHeight(height/4);
            final Button button2 = (Button) findViewById(R.id.Button02); 
            button2.setHeight(height/4);
            final Button button3 = (Button) findViewById(R.id.Button03); 
            button3.setHeight(height/4);
            final Button button4 = (Button) findViewById(R.id.Button04); 
            button4.setHeight(height/4);
    Il y a 4 boutons dont la taille doit être la même et ils doivent occuper toutes la fenêtre.
    Pour y arriver j'ai du "tricher" en utilisant :
    height = height - 50;
    ce que je voudrais éviter

  4. #4
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 035
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 035
    Par défaut
    tu peut monter ton fichier xml?
    EN gros tu veut que tes 4 boutons se partagent l'espace? As tu essayé avec les poids?

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    182
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 182
    Par défaut
    Oui c'est ce que je voudrais.
    Je vais essayer les poids

    Voici mon fichier xml :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    <?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="fill_parent"
        >
     
    <Button android:id="@+id/Button01" android:layout_height="wrap_content" android:text="@string/bt1_text" android:layout_width="fill_parent"></Button>
    <Button android:id="@+id/Button02" android:layout_height="wrap_content" android:text="@string/bt2_text" android:layout_width="fill_parent"></Button>
    <Button android:id="@+id/Button03" android:layout_height="wrap_content" android:text="@string/bt3_text" android:layout_width="fill_parent"></Button>
    <Button android:id="@+id/Button04" android:layout_height="wrap_content" android:text="@string/bt4_text" android:layout_width="fill_parent"></Button>
    </LinearLayout>

  6. #6
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 035
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 035
    Par défaut
    avec le même poids

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <?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="fill_parent"
        >
     
    <Button android:id="@+id/Button01" android:layout_height="wrap_content" android:text="@string/bt1_text" android:layout_width="fill_parent" android:layout_weight="1"></Button>
    <Button android:id="@+id/Button02" android:layout_height="wrap_content" android:text="@string/bt2_text" android:layout_width="fill_parent" android:layout_weight="1"></Button>
    <Button android:id="@+id/Button03" android:layout_height="wrap_content" android:text="@string/bt3_text" android:layout_width="fill_parent" android:layout_weight="1"></Button>
    <Button android:id="@+id/Button04" android:layout_height="wrap_content" android:text="@string/bt4_text" android:layout_width="fill_parent" android:layout_weight="1"></Button>
    </LinearLayout>
    pourquoi il te fallait enlever 50 à la hauteur?

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

Discussions similaires

  1. Hauteur barre de titre
    Par allergique dans le forum VB 6 et antérieur
    Réponses: 5
    Dernier message: 20/06/2017, 12h07
  2. Hauteur de la barre de titre d'une fiche
    Par gurvan1983 dans le forum C++Builder
    Réponses: 3
    Dernier message: 22/06/2007, 22h47
  3. Icône dans la barre de titre
    Par Sephi dans le forum MFC
    Réponses: 7
    Dernier message: 28/10/2003, 17h58
  4. [VB6] masquer la barre de titre d'une form
    Par tiboleo dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 09/12/2002, 17h54
  5. [VB6] Déplacer la form sans cliquer sur la barre de titre
    Par Ingham dans le forum VB 6 et antérieur
    Réponses: 4
    Dernier message: 14/11/2002, 02h09

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