如何在选项卡中去掉水平滚动条?

3
我想去掉TabHost中的水平滚动条。即使TabWidget在顶部也会出现。

alt text

以下是我的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>
2个回答

2

在框架布局中,以下方法适用于我:

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

2

将其嵌套到线性布局中

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接