Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TabLayout | TabIndicator Unselected Color [duplicate]

I am working with TabLayout

I need to set the color of TabIndicator when its not selected.

This is what i need to do -

enter image description here

This is what i have done -

enter image description here

like image 284
Shoeb Siddique Avatar asked Oct 22 '25 03:10

Shoeb Siddique


1 Answers

Use app:tabTextColorfor this .

  • When Unselected it will show app:tabTextColor

  • When Selected it will show app:tabSelectedTextColor

Use below code :

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    app:tabGravity="fill"
    app:tabMode="fixed"
    android:background="@color/colorPrimary"
    app:tabIndicatorColor="@color/white"
    app:tabIndicatorHeight="4dp"
    app:tabSelectedTextColor="@color/white"
    app:tabTextColor="#AAAAAA"
    app:tabTextAppearance="@style/NavigationTabTextAppeareance"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="4dp"
    >

styles.xml : for bold Tabtext

 <style name="NavigationTabTextAppeareance" parent="TextAppearance.Design.Tab">
    <item name="android:textStyle">bold</item>
</style>

For Unselected Tab bottom color :

Reference: TabLayout color of unselected tab underline

like image 74
Abhishek kumar Avatar answered Oct 25 '25 07:10

Abhishek kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!