Android的设计TabLayout标签字体大小 [英] Text size of android design TabLayout tabs
问题描述
我有困难,改变设计库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>
但我有2个副作用:
but I have 2 side effects :
1)我失去了选择的选项卡的强调色
1) I lost the accent color of the selected tab
2)的标签文本不大写了。
2) The tab text is not capitalized any more.
推荐答案
继续使用tabTextAppearance像你一样,但
Go on using tabTextAppearance as you did but
1),以修复大写字母副作用在你的样式添加textAllCap:
1) to fix the capital letter side effect add textAllCap in your style :
<style name="MyTabLayoutTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse">
<item name="android:textSize">14sp</item>
<item name="android:textAllCaps">true</item>
</style>
2)以固定选择的标签颜色的副作用在TabLayout XML添加以下库属性:
2) to fix the selected tab color side effect add in TabLayout xml the following library attributes :
app:tabSelectedTextColor="@color/color1"
app:tabTextColor="@color/color2"
希望这有助于。
Hope this helps.
这篇关于Android的设计TabLayout标签字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!