Question

J'ai un écran qui utilise des onglets dans mon application Android. Il y a une ligne (comme une frontière) qui indique entre le tabwidget et le framelayout. Je veux me débarrasser de cette ligne, mais ne peux pas l'air de trouver ce qu'il est. J'ai déterminé qu'il fait partie du FrameLayout en définissant sa visibilty à parti. S'il vous plaît se référer au code ci-dessous:

<?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">

<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"        
    android:background="#fb8c10"
    >

    <ImageView
    android:id="@+id/img_confirm_header"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/confirm_header"                 
    />

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:layout_marginBottom="0dip"
        android:background="#fb8c10"                              
        android:tabStripEnabled="false"                         
        />

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"            
        android:background="@drawable/tab_bg"                                                
         />
</LinearLayout>
</TabHost>

Ceci est un lien de la configuration actuelle et ce que je suis en train de faire http://img441.imageshack.us/g/screenshot20110116at513.png/

La mise en page d'orange est mon application, et le gris est ce que je suis en train de le faire.

Notez comment dans la capture d'écran gris de l'onglet se jette dans la trame.

Toutes mes excuses pour les liens, je ne peux pas les images encore: p post

Merci!

Était-ce utile?

La solution

J'ai réussi à résoudre ce problème en manipulant le z-index en utilisant la disposition relative. Je suis en mesure de positionner les pattes un peu plus de la mise en page du cadre. Reportez-vous au code ci-dessous:

<?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">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"        
        android:background="#fb8c10"
        >
        <ImageView
        android:id="@+id/img_confirm_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/tab_header"

        />
        <RelativeLayout
        android:id="@+id/widget77"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:color/transparent"
        >                    
            <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"            
            android:background="@android:color/transparent"                             
            android:layout_marginTop="33dip"                                                   
             />
             <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"            
            android:background="#fb8c10"                              
            android:tabStripEnabled="true"  
            android:layout_above="@android:id/tabcontent"
            android:layout_marginBottom="40dip"                                            
            />
        </RelativeLayout>
    </LinearLayout>
</TabHost>

Autres conseils

En ce moment, je suis tombé sur cette question. Cependant, j'ai aussi essayé de supprimer la bordure supérieure de FrameLayout. Je l'ai fait. mais je ne pense pas que ce soit un moyen de supprimer la bordure supérieure. de toute façon FYI,

Il suffit de placer un TextView avec le blanc de fond sur la frontière et l'utilisation AbsoluteLayout.

Par exemple:

<AbsoluteLayout>

<TabHost 
    android:layout_x="0dip"
    android:layout_y="5dip" ...>

    <AbsoluteLayout android:padding="5dip" android:background="#ffffff">
        <TabWidget/>
        <FrameLayout ....
        android:layout_x="0dip" android:layout_y="65dip" />
    </AbsoluteLayout>

</TabHost>

  <TextView 
    android:layout_width="fill_parent" android:layout_height="25dip" 
    android:layout_x="0dip" android:layout_y="65dip" 
    android:background="#ffffff"/>

</AbsoluteLayout>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top