2011-11-04 34 views
2

我正在開發一個使用標籤的應用程序。我想自定義標籤外觀。我想要刪除一個小行出現在選項卡下,而不是淡出線。我嘗試了很多TabHost的方法,但無法擺脫它。我想,這很簡單,但我找不到方法。如何刪除選項卡下方的漸變線上方的線?

我檢查這個鏈接:

https://stackoverflow.com/questions/3511596/get-rid-of-the-line-under-tabwidget

How to remove black line from tabbar in Android?

不過這也解釋了刪除線的衰落,我不需要。

我想刪除圖像中紅色圓圈的線,我該怎麼做?

enter image description here

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

@Paresh Mayani:我已經通過了它,但它解釋了刪除所有選項卡下的漸變線。我需要刪除它上面的那個。 – Hiral

+0

向我們顯示您的標籤部件代碼。 –

+0

@Yashwanth庫馬爾:我試圖做到這一點,使用tabhost.setStripeEnabled()編程方式根據上的答案,但我沒有找到任何這樣的方法。我正在使用android 2。1,所以我認爲,它不被支持。 – Hiral

回答

4

我沒有找到一個辦法解決,以得到它的Android 2.1.so工作我終於轉化項目至Android 2.2,現在擺脫了使用小黑線:

tabHost.getTabWidget().setStripEnabled(false); 
+0

它不再工作在三星設備 –

0
How to remove black line from tabbar in Android? 

公關與您的查看具有背景屬性。

如果您爲View設置背景,它將在您的Layout中顯示爲水平線。

所以刪除您的背景屬性android:background="#9deafa"

<View 
     android:layout_width="fill_parent" 
     android:layout_height="2dip" 
     android:paddingLeft="5dip" 
     android:paddingRight="5dip" 
    /> 
+0

但我沒有代碼刪除該行。如何查看現在可以成爲一個問題?請爲我提供該代碼。我將使用已刪除的視圖來檢查該代碼。 – Hiral

+0

@Hiral從你的xml中移除android:background =「#9deafa」。 – Venky

0

它的工作讓我非常漂亮:

應用自定義主題,以您的活動,並空出機器人:windowContentOverlay屬性。

定義主題的themes.xml

<style name="YourTheme" parent="if you want"> <item name="android:windowContentOverlay">@null</item> </style>

適用於你的應用程序或主題在AndroidManifest.xml活動:

<application android:theme="@style/YourTheme" ... >

0

添加此行 android:tabStripEnabled =「false」 位於XML文件的TabWidget標記中。

+0

不工作...... :( – Virthuss