I have this code for change color of text of tab layout, but it does not work at all!
app:tabTextColor
does not work, and it cant change color to white.
<android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" app:tabIndicatorColor="@color/blue" app:tabIndicatorHeight="5dp" app:tabTextColor="@color/white" />
Right-click the worksheet tab whose color you want to change. Choose Tab Color, and then select the color you want. The color of the tab changes, but not the color of the font. When you choose a dark tab color, the font switches to white, and when you choose a light color for the tab, the font switches to black.
Try with it -
<android.support.design.widget.TabLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:tabMode="fixed" app:tabGravity="fill" android:background="@color/colorWhite" app:tabTextColor="@color/colorBlack" app:tabSelectedTextColor="@color/colorPrimary"/>
Use this code it would help in all api level api 18 to api 26
tabLayout.setupWithViewPager(viewPager,true); tabLayout.setSelected(true); tabLayout.setTabTextColors(getResources().getColor(R.color.colorHintTextLight), getResources().getColor(R.color.colorPrimaryTextLight)); <color name="colorHintTextLight">#80FFFFFF</color> <color name="colorPrimaryTextLight">#FFFFFF</color>
that would help u.it helps me when tab layout change the position.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With