<com.google.android.material.tabs.TabLayout
android:id="@+id/tl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_top"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/theme"
app:tabIndicator="@color/theme"
app:tabIndicatorHeight="1dp"
app:tabTextAppearance="@style/TabLayoutTextStyle"
></com.google.android.material.tabs.TabLayout>
<style name="TabLayoutTextStyle" parent="TextAppearance.Design.Tab">
<item name="android:textSize">16dp</item>
<item name="android:textStyle">bold</item>
</style>
注意字体style继承TextAppearance.Design.Tab,之前百度的字体style不需要继承就可以,可能是tablayout在不同包下的原因。
本文详细介绍如何使用Android Material Design库中的TabLayout组件,并自定义其样式,包括字体大小、样式及选中颜色等属性,实现美观且符合应用主题的标签布局。
397

被折叠的 条评论
为什么被折叠?



