Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set unselected Text Color for TabLayout.Tab - Android

How do you set text-color for a tab that's not selected? I know you can set the text-color for the TabLayout by doing: setTabTextColors

like image 376
Tim Nuwin Avatar asked Dec 28 '16 18:12

Tim Nuwin


People also ask

How do I change the text color on a tab?

Choose Tab Color, and then select the color you want. The color of the tab changes, but not the color of the font.

Can we use tabLayout without ViewPager in Android?

It is possible to use a TabLayout without a ViewPager by using a TabLayout. OnTabSelectedListener . For navigation within an Activity , manually populate the UI based on the tab selected.

How do I disable tabLayout click?

the method has slightly different on the time of its invocation, you just have to setup your tabitem to disable its click after all viewpager fragment already added.


1 Answers

Use app:tabTextColor for default tab color and app:tabSelectedTextColor for selected tab color.

        <android.support.design.widget.TabLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabTextColor="#000000"
            app:tabSelectedTextColor="#FFFFFF"/>
like image 51
Saurabh Padwekar Avatar answered Sep 22 '22 22:09

Saurabh Padwekar