TabLayout scrollable tabs padding is calculated badly

Viewed 739

We have this TabLayout in xml:

<android.support.design.widget.TabLayout
    android:id="@+id/sliding_tabs"
    app:tabGravity="fill"
    app:tabContentStart="@dimen/tab_content_start"
    app:tabIndicatorColor="@color/MaterialDividerColor"

    app:tabSelectedTextColor="@color/DarkRed"
    app:tabTextColor="@color/Black"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

The problem is, when displaying on a tablet it looks really weird, all the tabs have the same width and therefor have each wildly different padding:

enter image description here

Surprisingly, on a phone it works as expected, or at least the problem is not visible:

enter image description here

I am using the 23.2.0 support library, which frankly looks full of bugs.

1 Answers

When you have TabLaout which app:tabMode="scrollable", You need to give some value to tabMinWidth, such as app:tabMinWidth="40dp". Otherwise, tab paddings wouldn't work.

Related