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

后端 未结 7 1639
南笙
南笙 2020-12-03 01:51

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?

相关标签:
7条回答
  • 2020-12-03 02:03

    For disabling that line below use tab:

    app:tabIndicator="@null"
    
    0 讨论(0)
  • 2020-12-03 02:07

    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"
    
    0 讨论(0)
  • 2020-12-03 02:07

    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.

    0 讨论(0)
  • 2020-12-03 02:12

    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>  
    
    0 讨论(0)
  • 2020-12-03 02:12

    just do this in your tabWidget in your xml file.

    android:tabStripEnabled="false"
    

    hope you get it. ;)

    0 讨论(0)
  • 2020-12-03 02:19

    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>
    
    0 讨论(0)
提交回复
热议问题