android - what is the best way to set the tab layout tabmode for tablets? -
i using tablayout android design support library. how can use mode_scrollable along gravity_fill looks same across devices , orientations?
currently if use mode_scrollable, looks on 7" tablet, on 10" tablet, tabs aligned left. want able use gravity_fill sizes.
this tablayout:
<android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="72dp" />
and setting mode in code
tablayout.settabmode(tablayout.mode_scrollable);
per tablayout.gravity_fill documentation:
gravity used fill
tablayout
as possible. option takes effect when used mode_fixed.
therefore setting mode mode_scrollable, tabs aligned starting edge - difference between tablets , phones mode_scrollable minimum width of tabs, set tabs material design spec.
note can specify both gravity , tab mode via xml if want set view scrollable:
<android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="72dp" app:tabmode="scrollable" />
Comments
Post a Comment