我怎样才能更改ActionBarSherlock的字体样式 [英] How can I change the font style on ActionBarSherlock

查看:205
本文介绍了我怎样才能更改ActionBarSherlock的字体样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要如何更改字体大小为使用的主题为ActionBarSherlock行动吧?

How do I change the font size for the title of the Action bar using Themes for ActionBarSherlock?

我的主题此刻(适用于我的整个应用如下):

My theme at the moment (applied to my whole application is as follows):

<style name="Theme.MyAppDefaults" parent="@style/Theme.Sherlock.Light">
         <item name="android:textSize">@dimen/default_textsize</item>
         <item name="actionBarSize">@dimen/action_bar_height</item>
</style>

注意字体大小设置为在我的应用程序的所有视图设置。只是没有动作条的字体。

Notice that the font size is set as set on all the Views in my app. Just not the ActionBar's font.

推荐答案

我用下面的主题得到了这个工作:

I got this working by using the below theme:

<style name="Theme.MyApp.Default" parent="@style/Theme.Sherlock.Light">
       <item name="actionBarStyle">@style/MyApp.SherlockActionBarStyle</item>
       <item name="android:actionBarStyle">@style/MyApp.SherlockActionBarStyle</item>
</style>

<style name="MyApp.SherlockActionBarStyle" parent="@style/Widget.Sherlock.ActionBar">
       <item name="titleTextStyle">@style/MyApp.ActionBar.TextAppearance</item>
</style>

<style name="MyApp.ActionBar.TextAppearance" parent="@style/TextAppearance.Sherlock.Widget.ActionBar.Menu">
      <item name="android:textSize">@dimen/default_textsize</item>
      <item name="android:textColor">@color/dark_grey</item>
 </style>

注意文本大小是命名样式 MyApp.ActionBar.TextAppearance 。另据 ActionBarSherlock 的主题应该在两个机器人prefixed属性和正常的属性进行设置(见actionBarStyle风格Theme.MyApp .DEFAULT以上。)

Notice the Text size is in the style named MyApp.ActionBar.TextAppearance. Also according to ActionBarSherlock the theme should be set on both android prefixed attributes and normal attributes (See actionBarStyle in style Theme.MyApp.Default above.)

这篇关于我怎样才能更改ActionBarSherlock的字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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