18

Is it possible to remove the bottom line showed in the tab bar? It is grey when not selected.

And is it possible to change the yellowish color to something else?

alt text

layout xml: http://pastebin.com/M2KqtH1r

droidgren
  • 6,898
  • 8
  • 31
  • 27

7 Answers7

39

just do this in your tabWidget in your xml file.

android:tabStripEnabled="false"

hope you get it. ;)

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
Jashan PJ
  • 4,177
  • 4
  • 27
  • 41
20

In AndroidManifest.xml:

 <activity android:name=".ActivityName" android:theme="@style/tabTheme"/> 

In values/styles.xml:

 <style name="tabTheme" parent="android:style/Theme"> 
      <item name="android:tabWidgetStyle">@style/Widget.TabWidget</item>
 </style> 

 <style name="Widget.TabWidget" parent="android:Theme"> 
      <item name="android:tabStripEnabled">false</item>
 </style>  
Siklab.ph
  • 991
  • 11
  • 17
  • 5
    Thanks for your addition, Could be good to know that the option "tabStripEnabled" was introduced in Android 2.2 i.e API Level 8. And for older API there is a workaround here :http://stackoverflow.com/questions/3164325/tabstripenabled-for-tabwidget-in-older-apis – droidgren Jul 25 '11 at 16:33
16

android:tabStripEnabled="false" didnt work for me
By doing the following i was able to get it working

<android.support.design.widget.TabLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabIndicatorColor="@android:color/transparent"
        app:tabIndicatorHeight="0dp" />

These 2 are the main things

 app:tabIndicatorColor="@android:color/transparent"
            app:tabIndicatorHeight="0dp"
Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52
2

Finally I solved it by:

android:alpha="0"

Here the full code:

<?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">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center_horizontal">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:tabStripEnabled="false"
            android:alpha="0"
            style="@style/TabStyle" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
</TabHost>
xackobo
  • 261
  • 2
  • 4
2

You have customize your tab indicator. That is to overriding your tabwidget style. I had this problem already. Check these two posts: post 1 and post 2.

halfer
  • 19,824
  • 17
  • 99
  • 186
Praveen
  • 90,477
  • 74
  • 177
  • 219
1

It seems that the way of doing that is to nest the tabwidget in a LinerLayout... Look here.

Community
  • 1
  • 1
Sephy
  • 50,022
  • 30
  • 123
  • 131
  • I was hoping that would work, but it didn't. The guy seem to be running 1.5 but I am running 2.2. However I have updated my post with my layout xml. – droidgren Aug 23 '10 at 04:37
0

For disabling that line below use tab:

app:tabIndicator="@null"
Timisorean
  • 1,388
  • 7
  • 20
  • 30