Android Layout Design Library

I am using TabLayout from the new android.support.design.widget package.

<android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabGravity="fill"
        app:tabIndicatorColor="@android:color/white"
        app:tabMode="fixed" />

      

But on tablets they look like

enter image description here

How to stretch them to fill the full width. Thank.

+3


source to share


1 answer


Got a response from Tab does not accept full width on tablet device [Using android.support.design.widget.TabLayout]

Credit goes to Kaizi



Implement your own TabLayoutStyle like this

<style name="MyTabLayout" parent="Widget.Design.TabLayout">
        <item name="tabGravity">fill</item>
        <item name="tabMaxWidth">0dp</item>
</style>

      

+5


source







All Articles