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?
layout xml: http:开发者_StackOverflow//pastebin.com/M2KqtH1r
just do this in your tabWidget in your xml file.
android:tabStripEnabled="false"
hope you get it. ;)
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>
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"
you have customize your tab indicator. that is to overriding your tabwidget style. I had this problem already. check these two posts. post1 and post2 . Hope it helps.
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>
It seems that the way of doing that is to nest the tabwidget in a LinerLayout... Look here.
For disabling that line below use tab:
app:tabIndicator="@null"
精彩评论