Android Tabhost底部边框线

Android Tabhost底部边框线,android,android-tabhost,Android,Android Tabhost,请注意,选项卡下面有一条很小的灰线(所选选项卡除外)?我该如何改变 这是FrameLayout、tabHost还是TabWidget的一部分?我就是找不到办法来改变或删除这条小灰线 感谢您创建tabindicator.xml,如下所示 然后将以下代码插入到TabActivity类中。 在这里,您可以根据需要更改tabindicator.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android

请注意,选项卡下面有一条很小的灰线(所选选项卡除外)?我该如何改变

这是FrameLayout、tabHost还是TabWidget的一部分?我就是找不到办法来改变或删除这条小灰线


感谢您创建tabindicator.xml,如下所示

然后将以下代码插入到TabActivity类中。

在这里,您可以根据需要更改tabindicator.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
  <ImageView android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"/>
</RelativeLayout>

这是tabindicator.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">

<ImageView android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />

<RelativeLayout/>

这里有一种更简单的方法来删除灰线。将其添加到布局中的TabWidget:

android:tabStripEnabled="false"

我也有同样的问题。我在Stackoverflow和Google上搜索了很多次,但都没有找到答案。现在我解决了。这就是为什么:

tabWidget.setRightStripDrawable(R.drawable.tab_strip);
tabWidget.setLeftStripDrawable(R.drawable.tab_strip);

tab\u strip
是png图像(宽度:50px,高度:2px)

简单易用!谢谢
tabWidget.setRightStripDrawable(R.drawable.tab_strip);
tabWidget.setLeftStripDrawable(R.drawable.tab_strip);