There is such an activity:

enter image description here

Tabs need to be stretched as if it were a LinearLayout and FORM with PREVIEW had the same weights (they share the width the same way).

Markup:

 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/suggestCoordinator" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#f5f5f5" android:clickable="true"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/orange_gradient" android:fitsSystemWindows="true"> <android.support.v7.widget.Toolbar android:id="@+id/suggestToolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@drawable/orange_gradient" android:clickable="true" android:fitsSystemWindows="true" app:layout_scrollFlags="scroll|enterAlwaysCollapsed" app:popupTheme="@style/Theme.AppCompat.Light.NoActionBar" app:theme="@style/Theme.AppCompat.NoActionBar" /> <android.support.design.widget.TabLayout android:id="@+id/suggestTabLayout" style="@style/MyCustomTabLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="false" android:fitsSystemWindows="true" android:longClickable="false" android:paddingLeft="1dp" app:tabIndicatorColor="@android:color/white" app:tabIndicatorHeight="4dp" app:tabMode="scrollable" app:tabSelectedTextColor="@android:color/white" app:tabTextColor="@android:color/white" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/suggestViewPager" android:layout_width="match_parent" app:tabGravity="center" android:layout_height="match_parent" android:clickable="true" android:fitsSystemWindows="true" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout> 

Ps. app:tabGravity="center" set fill - does not help.

    1 answer 1

    Apparently the thing is in the app: tabMode = "scrollable" - because of this value, tabs occupy the minimum width for themselves. You need all the free space. To do this, change mode to fixed.

    Do this:

     app:tabGravity="fill" app:tabMode="fixed"