Tab not taking full width on Tablet device [Using android.support.design.widget.TabLayout]

Max picture Max · Jun 15, 2015 · Viewed 89.5k times · Source

I have setup tabs as UPDATE 29/05/2015 this post. Tabs take full width on my Nexus 4 mobile but on nexus 7 tablet it in center and not cover full screen width.

Nexus 7 screenshot Nexus7 Nexus 4 screenshot Nexus 4

Answer

Adam Johns picture Adam Johns · Jul 25, 2015

A "simpler" answer borrowed from Kaizie would just be adding app:tabMaxWidth="0dp" in your TabLayout xml:

<android.support.design.widget.TabLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMaxWidth="0dp"
            app:tabGravity="fill"
            app:tabMode="fixed" />