2011-01-16 14 views
1

Ich habe einen Bildschirm, der Registerkarten in meiner Android-Anwendung verwendet. Es gibt eine Linie (wie eine Grenze), die zwischen dem Tabwidget und dem Framelayout angezeigt wird. Ich möchte diese Linie loswerden, aber ich kann nicht finden, was es ist. Ich habe festgestellt, dass es Teil des FrameLayout ist, indem ich seine Sichtbarkeit auf "weg" setze. Bitte beachten Sie den Code unten:oberen Rand auf FrameLayout bei Verwendung von Tabs

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

Dies ist ein Link des aktuellen Layouts ist und was ich versuche http://img441.imageshack.us/g/screenshot20110116at513.png/

Das orange Layout ist meine app zu tun, und das Grau ist das, was ich Ich versuche es zu tun.

Beachten Sie, wie in der grauen Screenshot die Registerkarte in den Rahmen fließt.

Apologies für die Links, ich Bilder noch nicht veröffentlichen können: p

Dank!

Antwort

1

konnte ich dieses Problem zu lösen, indem den z-Index mit relativem Layout zu manipulieren. Ich konnte die Tabs leicht über das Rahmenlayout positionieren. Siehe unten stehenden Code:

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

Gerade jetzt stieß ich auf dieses Problem. Ich habe jedoch auch versucht, den oberen Rand von FrameLayout zu entfernen. Ich habe es gemacht. aber ich denke nicht, dass es eine Möglichkeit ist, die obere Grenze zu entfernen. trotzdem FYI,

Platzieren Sie einfach eine TextView mit Hintergrund weiß auf Border und verwenden Sie AbsoluteLayout.

Eg:

<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> 
+0

danke für die Antwort, aber ich mag keine absolute Positionierung, weil ich mehrere Bildschirmgrößen anvisiere. Ich konnte das lösen, aber ich werde den Code oben veröffentlichen – jamiltao

Verwandte Themen