<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
这样设置属性可以在手机上正常显示,标题可以匹配屏幕的宽度,但是到了平板上就只能显示在屏幕中间的,宽度也变成包裹内容了。
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabGravity="fill"
android:layout_width="match_parent"
android:layout_height="@dimen/tabLayout_hight">后经过试验:
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabGravity="fill"加上这三行代码就可以在平板上完美运行啦!