【发布时间】:2017-04-10 14:28:13
【问题描述】:
app:tabMode="scrollable"时想集中TabLayout
我的TabLayout
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_gravity="center"
android:background="@android:color/white"
android:gravity="center"
android:visibility="visible"
app:tabGravity="fill"
app:tabIndicatorHeight="0dp"
app:tabMaxWidth="0dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/colorTabSelected"
app:tabTextAppearance="@style/CustomTextStyle"
app:tabTextColor="@color/colorTabNormal"></android.support.design.widget.TabLayout>
采用这种布局。像这样的标签布局(但所有标签都左对齐):
如果app:tabMode="fixed",中心选项卡中的文本将比其他文本小。
所以。如果app:tabMode="fixed"(所有选项卡都居中对齐),我想让 TabLayout 中的所有文本大小相同。如果app:tabMode="scrollable",我想集中标签(如tabMode fixed)。
谢谢
【问题讨论】: