如何改变tabhost在Android上的字体大小 [英] How to change the font size of tabhost in android

查看:420
本文介绍了如何改变tabhost在Android上的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能标签的字体大小被改变?我向TabActivity的标签。

How can the font size of the tabs be changed? I extend TabActivity for the tabs.

推荐答案

您可以定义主题,使用样式来实现这一点:

You can define themes, use styles to achieve this:

首先创建的主题(名称: CustomTheme )为您的活动 RES /价值/ styles.xml

First you create the theme (name:CustomTheme) for your Activity in your res/values/styles.xml:

<style name="CustomTheme" parent="@android:style/Theme">
    <item name="android:tabWidgetStyle">@style/CustomTabWidget</item>
</style>
<style name="CustomTabWidget" parent="@android:style/Widget.TabWidget">
    <item name="android:textAppearance">@style/CustomTabWidgetText</item>
</style>
<style name="CustomTabWidgetText" 
    parent="@android:style/TextAppearance.Widget.TabWidget">
    <item name="android:textSize">20sp</item>
    <item name="android:textStyle">bold</item>
</style>

然后在你的的Andr​​oidManifest.xml 指定上面为主题的 TabActivity 活动包含你的 TabWidget

Then in your androidManifest.xml you specify the theme above for your TabActivity or Activity containing your TabWidget:

<activity android:name="MyTabActivity" android:theme="@style/CustomTheme">

这将有助于你和你想要的(当然,你应该改变的大小和样式为您的preference)。

This will serve you with the output you want (of course you should change the size and style for your preference).

这篇关于如何改变tabhost在Android上的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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