Android Studio 3.1,Gradle 4.1,Java 1.8
Android 6.0
我将字体大小更改为巨大
在我的布局中:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
style="@style/TabLayoutStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/tile_preview_margin"
android:layout_marginLeft="@dimen/tile_preview_margin"
android:layout_marginRight="@dimen/tile_preview_margin"
android:layout_marginStart="@dimen/tile_preview_margin"
android:background="@android:color/white"
android:minHeight="@dimen/standard_min_height_container"
android:textAlignment="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchViewContainer"
app:tabGravity="fill"
app:tabIndicatorColor="@color/colorPrimaryDark"
app:tabIndicatorHeight="2dp"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/colorPrimaryDark" />
styles.xml 中的
<style name="TabLayoutStyle" parent="Base.Widget.Design.TabLayout">
<item name="tabTextAppearance">@style/TabLayoutTextAppearanceStyle</item>
</style>
<style name="TabLayoutTextAppearanceStyle" parent="TextAppearance.AppCompat.Button">
<item name="android:textSize">20sp</item>
<item name="android:textColor">@color/tabTextColor</item>
<item name="android:textAllCaps">false</item>
<item name="android:textStyle">bold</item>
</style>
结果如下:
如您所见,第一个标签(品牌)字体的大小不同。为什么呢?