当标签只有有个的时候,标签不能居中显示
<android.support.design.widget.TabLayout android:id="@+id/tabs" style="@style/TabLayoutTextStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:background="#ffffff" android:gravity="center" app:tabMode="scrollable" app:tabGravity="center" app:tabSelectedTextColor="@android:color/holo_red_light" app:tabTextColor="#000000" app:tabIndicatorColor="@android:color/holo_red_light" app:tabIndicatorHeight="1dp" />网上有这种说法: app:tabGravity=”fill”和app:tabMode=”fixed”但是不起作用
此时的解决办法是设置
app:tabMaxWidth="0dp" 即可解决问题!快去试试吧。