To begin with in drawable set the selector

tab_background.xml

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/tab_background_selected" android:state_selected="true" /> <item android:drawable="@drawable/tab_background_unselected" android:state_selected="false" android:state_focused="false" android:state_pressed="false" /> </selector> 

for the active tab tab_background_selected.xml

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#FFFFFF" /> </shape> 

for inactive tab tab_background_unselected.xml

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#000000" /> </shape> 

and in styles.xml define

 <style name="@style/AppTheme.TabLayout" parent="android:Widget"> <item name="tabBackground">@drawable/tab_background</item> </style> 

How to do next? directly in Tablayout set the style

 app:tabTextAppearance="@style/AppTheme.TabLayout" 

    0