如何更改操作栏标题的文字大小? [英] How to change size of title's text on Action Bar?

查看:156
本文介绍了如何更改操作栏标题的文字大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有每个Android 4.0的应用程序操作栏,它已获得了冠军。我需要这种规模较小。但我不明白我怎么能做到这一点,因为操作栏不提供公共方法吧。先感谢您。备注:我不希望使用自定义视图。

There is Action Bar on each Android 4.0 application, and it has got a title. I need to make this size less. But I don't understand how I can do it, because Action Bar doesn't provide public methods for it. Thank you in advance. Remark: I don't want to use custom views.

推荐答案

其实,你可以做你想做的自定义动作条的内容。它必须通过主题来进行。你可以这样做:

Actually, you can do what you want to customize the ActionBar. It must be done through the Theme. You can do something like this :

<style name="Theme.YourTheme" parent="android:style/Theme">
    <item name="android:actionBarStyle">@style/Theme.YourTheme.Styled.ActionBar</item>
</style>

<style name="Theme.YourTheme.Styled.ActionBar">
    <item name="android:titleTextStyle">@style/Theme.Viadeo.Styled.YourTheme.TitleTextStyle</item>
</style>

<style name="Theme.YourTheme.Styled.ActionBar.TitleTextStyle" parent="@android:style/Widget.TextView">
    <item name="android:textSize">12sp</item>
</style>

这篇关于如何更改操作栏标题的文字大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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