【问题标题】:How can I delete the line below my Tab layout?如何删除选项卡布局下方的行?
【发布时间】:2011-10-21 17:52:11
【问题描述】:

对不起我可怜的英语。我来自荷兰,我才 14 岁。

我正在练习我的 android 开发技能,但是我遇到了问题。如果我创建一个选项卡菜单,下面会出现一条水平线。黑色背景下你看不到它,但如果它是白色的,你会看到它。 ![http://img703.imageshack.us/img703/503/emulator.png][1]

我的问题很简单。我怎样才能删除那条线?此选项卡菜单的 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"
    android:background="#ffffff">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>

【问题讨论】:

    标签: android xml android-layout android-tabhost


    【解决方案1】:

    请尝试从FrameLayout 中删除android:padding="5dp"

    【讨论】:

    • 如果我这样做,这条线就会消失,但填充当然也会消失。如何在没有线的情况下恢复填充?
    • 您可以在框架布局内的视图中尝试边距或使用填充。如果有任何答案解决了您的问题,请不要忘记点击相应答案的右侧标记。
    • 我已经按照你的方式做了,我在 XML 文件中使用了填充。这很好用。谢谢。
    【解决方案2】:

    你试过here中的xml属性吗?

    【讨论】:

    • 我在那里找到了 android:tabStripEnabled。我认为这就是解决方案,但我必须在哪里以及如何使用它?我是android开发的新手,所以我没有任何经验。
    • tabStrip 是一条与活动选项卡颜色相同的线,位于其左右,位于非活动选项卡的下方
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-13
    相关资源
    最近更新 更多