Android 删除标签栏中的底线边框?(并更改所选颜色)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3543478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove the bottom line border in tab bar? (And change selected color)
提问by droidgren
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://pastebin.com/M2KqtH1r
布局xml:http: //pastebin.com/M2KqtH1r
回答by Jashan PJ
just do this in your tabWidget in your xml file.
只需在您的 xml 文件中的 tabWidget 中执行此操作。
android:tabStripEnabled="false"
hope you get it. ;)
希望你能明白。;)
回答by Siklab.ph
In AndroidManifest.xml:
在 AndroidManifest.xml 中:
<activity android:name=".ActivityName" android:theme="@style/tabTheme"/>
In values/styles.xml:
在 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>
回答by Mightian
android:tabStripEnabled="false" didnt work for me
By doing the following i was able to get it working
android:tabStripEnabled="false" 对我不起作用
通过执行以下操作,我能够使其正常工作
<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
这2点是主要的
app:tabIndicatorColor="@android:color/transparent"
app:tabIndicatorHeight="0dp"
回答by xackobo
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>
回答by Praveen
回答by Sephy
回答by subodh meshram
For disabling that line below use tab:
要禁用下面的那一行,请使用选项卡:
app:tabIndicator="@null"