droidgren
droidgren

Reputation: 7118

Remove the bottom line border in tab bar? (And change selected color)

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

Upvotes: 19

Views: 34981

Answers (8)

Ahmed Nabil
Ahmed Nabil

Reputation: 161

for TabLayout i used this solution :

just add this lines:

                    android:backgroundTint="@android:color/black"
                    app:tabIndicatorColor="@android:color/transparent"
                    app:tabIndicatorHeight="0dp"

Upvotes: 0

Praveen
Praveen

Reputation: 91175

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.

Upvotes: 2

subodh meshram
subodh meshram

Reputation: 1

For disabling that line below use tab:

app:tabIndicator="@null"

Upvotes: 0

Aniruddha K.M
Aniruddha K.M

Reputation: 7511

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"

Upvotes: 15

xackobo
xackobo

Reputation: 361

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>

Upvotes: 2

Jashan PJ
Jashan PJ

Reputation: 4398

just do this in your tabWidget in your xml file.

android:tabStripEnabled="false"

hope you get it. ;)

Upvotes: 39

Siklab.ph
Siklab.ph

Reputation: 1021

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>  

Upvotes: 20

Sephy
Sephy

Reputation: 50392

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

Upvotes: 1

Related Questions