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 :

Tabhost à positionner en bas


Sujet :

Android

  1. #1
    Membre du Club
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2012
    Messages
    75
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2012
    Messages : 75
    Points : 42
    Points
    42
    Par défaut Tabhost à positionner en bas
    Bonjour,

    avec le layout ci-dessous :

    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
    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/loading" >
     
        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
     
            <egingenierie.mfm.views.DownloaderImageView
                android:id="@+id/backgroundImage"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />
     
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical" >
     
                <LinearLayout
                    android:id="@+id/actionbar"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >
     
                    <TabWidget
                        android:id="@android:id/tabs"
                        android:layout_width="fill_parent"
                        android:layout_height="60dip"/>
                </LinearLayout>
     
                <android.support.v4.view.ViewPager
                    android:id="@+id/pager"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />
     
                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:visibility="gone" />
            </LinearLayout>
        </FrameLayout>
     
    </TabHost>
    ma tabhost fonctionne tres bien, ainsi que le programme. Cependant ici la Tabhost est au dessus de l'ecran et j'aimerai la positionner en bas.

    Et la, c'est le drame. Comme tout est un peu "relié" dans tout les sens dans ce Layout j'ai beau le modifier, rien a faire: a chaque fois que la tabhost est positionnee en bas, ca n'affiche qu'elle meme.

    Comment faire ?
    Merci pour votre aide.

  2. #2
    Membre extrêmement actif
    Avatar de Ryu2000
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2008
    Messages
    9 596
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Décembre 2008
    Messages : 9 596
    Points : 18 503
    Points
    18 503
    Par défaut
    Ça c'est un layout de TabHost et tu l'includes dans d'autres layout ?

    Normalement dans une RelativeLayout tu fais :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <include 
         layout="@layout/tabhost"
         android:layout_alignParentBottom="true" />
    Et ça devrait se situer en bas.
    Keith Flint 1969 - 2019

  3. #3
    Membre du Club
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2012
    Messages
    75
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2012
    Messages : 75
    Points : 42
    Points
    42
    Par défaut
    Quand je fais ca, ca situe bien la TabHost en bas, mais tout le reste disparait alors. Ce qui est facheux !

  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
    Bonjour

    Pourrais tu nous montrer ton layout.xml qui inclut la TabHost.

    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.

  5. #5
    Membre extrêmement actif
    Avatar de Ryu2000
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2008
    Messages
    9 596
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Décembre 2008
    Messages : 9 596
    Points : 18 503
    Points
    18 503
    Par défaut
    Peut être que le TabHost a ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    android:height="match_parent"
    Si la RelativeLayout s'affiche correctement sauf quand tu fais un include c'est louche.
    Keith Flint 1969 - 2019

  6. #6
    Membre régulier
    Homme Profil pro
    Lycéen
    Inscrit en
    Juillet 2012
    Messages
    72
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Lycéen

    Informations forums :
    Inscription : Juillet 2012
    Messages : 72
    Points : 90
    Points
    90
    Par défaut Voilà
    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
    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/loading" >
     
        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
     
            <egingenierie.mfm.views.DownloaderImageView
                android:id="@+id/backgroundImage"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />
     
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical" >
     
                <LinearLayout
                    android:id="@+id/actionbar"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >
     
                    <TabWidget
                        android:id="@android:id/tabs"
                        android:layout_width="fill_parent"
                        android:layout_height="60dip"/>
                </LinearLayout>
     
                <android.support.v4.view.ViewPager
                    android:id="@+id/pager"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />
     
                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:visibility="gone" />
            </LinearLayout>
        </FrameLayout>
     
    </TabHost>

    Ce que tu appelle le tabHost sont les "boutons" et donc les TabWidgets. Il suffit donc de passer les tabWidgets en dessous du FrameLayout comme ceci :
    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
    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/loading" >
     
     <android.support.v4.view.ViewPager
                    android:id="@+id/pager"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />
     
                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:visibility="gone" />
            </LinearLayout>
        </FrameLayout>
     
     
        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
     
            <egingenierie.mfm.views.DownloaderImageView
                android:id="@+id/backgroundImage"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />
     
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical" >
     
                <LinearLayout
                    android:id="@+id/actionbar"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >
     
                    <TabWidget
                        android:id="@android:id/tabs"
                        android:layout_width="fill_parent"
                        android:layout_height="60dip"/>
                </LinearLayout>
     
     
     
    </TabHost>
    Je suis pas sur-sur (essaye, ca coute rien) mais l'idée c'est de mettre le TabWidget ( avec l'id) en dessous du frame Layout (celui ayant pour id ) dans le layout et donc le TabWidget doit aussi etre en dessous dans le code.

    Voilà voilà!

  7. #7
    Membre extrêmement actif
    Avatar de Ryu2000
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2008
    Messages
    9 596
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Décembre 2008
    Messages : 9 596
    Points : 18 503
    Points
    18 503
    Par défaut
    Désolé mais je ne connais pas les FrameLayout ni les ViewPager.

    Cela dit, j'ai réussi à mettre tabs en bas.
    Il suffit de mettre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    android:layout_height="0dp"
    android:layout_weight="1"
    Dans le ViewPager.

    Comme c'est dans un LinearLayout vertical ça fonctionne comme tu veux.

    Je parle de ton premier code que tu as posté dans ton dernier message.
    Le second c'est juste n'importe quoi !

    Mais sinon comme on te le disait, tu pouvais simplement utilisé une RelativeLayout.
    Keith Flint 1969 - 2019

Discussions similaires

  1. Réponses: 2
    Dernier message: 24/05/2009, 23h23
  2. Se positionner en bas d'un div avec un scrollbar
    Par mdr_cedrick dans le forum Balisage (X)HTML et validation W3C
    Réponses: 5
    Dernier message: 16/03/2008, 21h11
  3. pb positionnement en bas d'une div
    Par bogsy15 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 7
    Dernier message: 27/07/2006, 14h27
  4. positionnement du bas de page
    Par la.sophe dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 25/02/2006, 20h37
  5. se positionner en bas de page
    Par jisse dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 22/09/2005, 10h49

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