【发布时间】:2014-03-18 20:26:40
【问题描述】:
我正在开发一个使用标签的应用程序。我想自定义标签外观。我想删除标签下出现的一条小线,而不是褪色线。 TabHost 的很多方法都试过了,都摆脱不了。我想,很简单,就是找不到方法。
我检查了这个链接:
https://stackoverflow.com/questions/3511596/get-rid-of-the-line-under-tabwidget
How to remove black line from tabbar in Android?
但这解释了删除褪色线,我不需要。
我想删除图片中红圈内的线,我该怎么做?
任何帮助appriciated。
编辑:
我的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"
android:fadingEdge="none" android:fadeScrollbars="false"
>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="5dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/title"
/>
<View
android:layout_width="fill_parent"
android:layout_height="5dip"
/>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="#9deafa"
android:paddingLeft="5dip"
android:paddingRight="5dip"
/>
<View
android:layout_width="fill_parent"
android:layout_height="5dip"
/>
<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="wrap_content"
android:padding="5dp" />
</LinearLayout>
</TabHost>
【问题讨论】:
-
@Paresh Mayani:我已经完成了,但它解释了删除所有选项卡下的褪色线。我只需要删除它上面的那个。
-
向我们展示您的标签小部件代码。
-
@Yashwanth Kumar:我尝试根据 SO 上的答案以编程方式使用 tabhost.setStripeEnabled() 来做到这一点,但我在那里没有找到任何这样的方法。我使用的是 android 2.1,所以我想,它不受支持。
-
@Yashwanth Kumar:但它是否还需要,尽管我对在那里删除这条线一无所知?它只是正常编码,标签可绘制几乎没有变化。
-
@Venky:我只是想改变drawable并删除这条黑线,其他的东西需要保持原样。所以如果这只是使用默认的TabHost来实现,我不想尝试自定义标签。你不知道有什么其他方法可以删除它吗??