android设计TabLayout选项卡的文字大小
问题描述:
我在更改设计库 tablayout (android.support.design.widget.TabLayout) 选项卡的文本大小时遇到困难.
I have difficulties changing the text size of the tabs of design library tablayout (android.support.design.widget.TabLayout).
我设法通过在 TabLayout 中分配 tabTextAppearance 来改变它
I managed to change it by assigning tabTextAppearance in TabLayout
app:tabTextAppearance="@style/MyTabLayoutTextAppearance"
以下样式
<style name="MyTabLayoutTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse">
<item name="android:textSize">14sp</item>
</style>
但我有两个副作用:
1) 我丢失了所选标签的强调色
1) I lost the accent color of the selected tab
2) 标签文本不再大写.
2) The tab text is not capitalized any more.
答
<style name="MineCustomTabText" parent="TextAppearance.Design.Tab">
<item name="android:textSize">16sp</item>
</style>
在TabLayout
中使用是这样的
<android.support.design.widget.TabLayout
app:tabTextAppearance="@style/MineCustomTabText"
...
/>