2

I am developing an app which uses tabs. I want to customize tab look.I want to remove a small line appears under tabs,not the fading line. I tried many methods of TabHost but could not get rid of it.I think,it is simple but i just can't find the way.

I checked this links:

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

How to remove black line from tabbar in Android?

But this explains to remove fading line,which i don't need.

I want to remove the line in red circle in image.How can I do that?

enter image description here

Any help appriciated.

EDIT :

My xml file is:

<?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>
Community
  • 1
  • 1
Hiral Vadodaria
  • 19,158
  • 5
  • 39
  • 56
  • @Paresh Mayani: I have already gone through it but it explains to remove the fading line under all tabs.I need to remove just the one above it. – Hiral Vadodaria Nov 04 '11 at 11:48
  • show us your tab widget code. – Yashwanth Kumar Nov 04 '11 at 11:51
  • @Yashwanth Kumar: I tried to do that using tabhost.setStripeEnabled() programatically according to an answer on SO but I didn't find any such method there. I am using android 2.1,so i thought,it is not supported. – Hiral Vadodaria Nov 04 '11 at 11:51
  • @Yashwanth Kumar: But is it yet required though i have nothing regarding removing this line there? it is just normally coded with little change in tab drawable. – Hiral Vadodaria Nov 04 '11 at 11:53
  • @Venky: I just wanted to change drawable and remove this black line,other things are needed to be as it is.So if this is achieved simply using default TabHost,i don't want to try custom tab.Don't you know any other way to remove this?? – Hiral Vadodaria Nov 04 '11 at 11:58
  • @Venky: View is used just to add space between components and that really does not make difference,i think. – Hiral Vadodaria Nov 04 '11 at 13:01
  • @Venky: I just didn't find any way to remove this.So I asked you any method you know to remove it? so removing View would not affect anything as i don't have any code to remove line yet. – Hiral Vadodaria Nov 04 '11 at 13:03
  • @Hiral If you give background for View attribute then it will appear as line. Remove background attribute.. You problem will solved. – Venky Nov 04 '11 at 13:04
  • Remove background and try – Venky Nov 04 '11 at 13:06
  • @Venky: View is displayed above the tab host.it is not displayed between TabWidget and FrameLayout. – Hiral Vadodaria Nov 04 '11 at 13:21

4 Answers4

4

I didn't find a way around to get it working in android 2.1.so finally I converted project to android 2.2 and now got rid of that little black line using:

  tabHost.getTabWidget().setStripEnabled(false);
Hiral Vadodaria
  • 19,158
  • 5
  • 39
  • 56
0

Its Work for Me Very Nicely:

Apply a custom theme to your activity, and null out the android:windowContentOverlay attribute.

Define a theme in themes.xml:

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

Apply the theme on your application or the activity in AndroidManifest.xml:

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

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
0

Add this line android:tabStripEnabled="false" in your TabWidget tag in XML file.

0
How to remove black line from tabbar in Android?

The problem is with your View with Background attribute.

If you give background for View it will shown as a Horizontal line in you Layout.

So remove you background attribute android:background="#9deafa"

    <View
        android:layout_width="fill_parent"
        android:layout_height="2dip" 
        android:paddingLeft="5dip"
        android:paddingRight="5dip"
    />
Venky
  • 11,049
  • 5
  • 49
  • 66