If you look at the basic Tablayout style:
<style name="Base.Widget.Design.TabLayout" parent="android:Widget"> <item name="tabMaxWidth">@dimen/tab_max_width</item> <item name="tabIndicatorColor">?attr/colorAccent</item> <item name="tabIndicatorHeight">2dp</item> <item name="tabPaddingStart">12dp</item> <item name="tabPaddingEnd">12dp</item> <item name="tabBackground">?attr/selectableItemBackground</item> <item name="tabTextAppearance">@style/TextAppearance.Design.Tab</item> <item name="tabSelectedTextColor">?android:textColorPrimary</item> </style>
You see these two lines
<item name="tabPaddingStart">12dp</item> <item name="tabPaddingEnd">12dp</item>
So, just create a style for your Tablayout as follows:
<style name="tab_bar"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">65dp</item> <item name="android:background">@color/backgroundColor</item> <item name="android:tabStripEnabled">false</item> <item name="tabPaddingStart">0dp</item> <item name="tabPaddingEnd">0dp</item> </style>
And use the style:
<android.support.design.widget.TabLayout android:id="@+id/tabs" app:tabGravity="fill" app:tabMode="fixed" style="@style/tab_bar"/>
Bart burg
source share