If you look into the TabLayout.class
you will notice inner TabView.class
for tab's actual layout. It's same layout as any other with isSelected
attribute. Selecting tab will also have impact on this so all you need to do is to create selector background drawable like
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@color/tab_bg_selected"/>
<item android:drawable="@color/tab_bg_unselected"/></selector>
and attach it to the tabBackground attribute e.g. in XML like
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabBackground="@drawable/tab_bg"
app:tabIndicatorHeight="4dp"/>