Android的设计TabLayout标签字体大小 [英] Text size of android design TabLayout tabs

查看:4691
本文介绍了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>

但我有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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆