android:tabStripEnabled="false"无效

4
我是使用tabhost并尝试禁用选项卡边框线的。我在XML中使用了android:tabStripEnabled="false",但似乎没有起作用,边框线仍然存在。我尝试了其他方法,比如在style.xml中进行更改(我在stackoverflow上找到的),但也没有起作用。有什么想法吗?
我的选项卡XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

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

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_above="@android:id/tabs" />

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:background="#FFFFFF"
                android:tabStripEnabled="false"
                android:layout_gravity="bottom" />
        </RelativeLayout>
    </TabHost>

</LinearLayout>
2个回答

2
你可以使用以下语句来移除选项卡底部的条纹和选项卡之间的分隔符。
    TabHost t;
    t.getTabWidget().setStripEnabled(false);
    t.getTabWidget().setDividerDrawable(R.drawable.ic_launcher);

仍然无法移除底部条,ic_launcher是什么? - coding_idiot

1

至少需要minSDK 8(2.2)...请检查您的清单。

确保您的代码中没有设置选项卡背景的行(我曾经遇到过这个问题...);)


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