android设计TabLayout选项卡的文字大小 [英] Text size of android design TabLayout tabs

查看:41
本文介绍了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"
            ...
            />

这篇关于android设计TabLayout选项卡的文字大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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