2010-07-14 35 views
3

我想擺脫TabHost中的水平滾動條。即使TabWidget位於頂端,它仍然存在。如何擺脫tabhost中的水平滾動條?

alt text http://img341.imageshack.us/img341/1879/brokentabs.png

下面是我的XML佈局。

<?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" > 
    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="fill_parent"  
     android:layout_height="fill_parent"/>     

    <TabWidget 
     android:id="@android:id/tabs"      
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:gravity="bottom" /> 
</TabHost> 

回答

3

巢它變成一個LinearLayout中

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 

    android:gravity="center_horizontal">  
    <TabHost 
    android:id="@android:id/tabhost"  
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
... 
... 
... 
    </TabHost> 
    </LinearLayout> 
+0

試了一下。不爲我工作。 – Geek 2013-10-15 16:16:06

2

把這個在框架佈局工作對我來說:

android:foreground="@null" 
android:layout_marginTop="-6dp"