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 :

[TabHsot] Modification du background des tabs


Sujet :

Android

Mode arborescent

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Rédacteur
    Avatar de David55
    Homme Profil pro
    Ingénieur informatique
    Inscrit en
    Août 2010
    Messages
    1 542
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2010
    Messages : 1 542
    Par défaut [TabHsot] Modification du background des tabs
    Bonjour à toutes et à tous,

    Je possèdes deux onglets pour mon tabHost. J'aimerai modifier le fond de chacun des onglets.

    Pour ce faire, je possède deux images. Cependant, je n'arrive pas à définir ces fonds pour chaque onglets.

    Pour info, voici mon 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
     
    <TabHost
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@android:id/tabhost"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/group"
                android:layout_marginBottom="@dimen/marginBottom"
                android:layout_marginLeft="@dimen/marginLeft"
                android:layout_marginRight="@dimen/marginRight"
                android:layout_marginTop="5dp" >
     
                <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical" >
     
                    <TabWidget
                        android:id="@android:id/tabs"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content" />
     
                    <FrameLayout
                        android:id="@android:id/tabcontent"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent" >
     
                        <FrameLayout
                            android:id="@+id/tabDetail1"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent" />
     
                        <FrameLayout
                            android:id="@+id/tabDetail2"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent" />
                    </FrameLayout>
                </LinearLayout>
            </TabHost>
    Et mon code JAVA:
    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
     
    private void addNewTab (String indicator, int id)
    	{
    		int totalTabs = tabhost.getTabWidget ().getChildCount ();
    		TabHost.TabSpec tSpec;
    		tSpec = tabhost.newTabSpec (indicator);
    		tSpec.setIndicator (indicator);
                    // Background des onglets
    		 if (totalTabs > 0)
    		// TODO : background onglet 2
    		 else
    		// TODO : background onglet 1
    		tSpec.setContent (id);
    		tabhost.addTab (tSpec);
    		totalTabs++;
    		((RelativeLayout) tabhost.getTabWidget ().getChildTabViewAt (totalTabs - 1)).removeViewAt (0);
    		((TextView) ((RelativeLayout) tabhost.getTabWidget ().getChildTabViewAt (totalTabs - 1)).getChildAt (0)).setHeight (30);
    		tabhost.getTabWidget ().getChildAt (totalTabs - 1).getLayoutParams ().height = 70;
    	}
    Merci d'avance pour vos éclaircissement.
    Images attachées Images attachées   

Discussions similaires

  1. Modification à la chaine des noms de contrôle
    Par dde78 dans le forum Access
    Réponses: 3
    Dernier message: 29/09/2005, 16h24
  2. [DEBUTANT][Javascript + CSS]Modification du background
    Par picomz dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 14/09/2005, 22h32
  3. modifer un seul des sous formulaire
    Par hades666evil dans le forum Access
    Réponses: 6
    Dernier message: 12/09/2005, 20h02
  4. probleme d'import de fichier txt avec des tab
    Par lecureuil dans le forum Access
    Réponses: 4
    Dernier message: 23/08/2005, 19h22
  5. Modification du caption des boutons lors d'un onBeforeUnload
    Par nico-pyright(c) dans le forum Général JavaScript
    Réponses: 13
    Dernier message: 23/08/2005, 17h12

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