主题中的TextAppearance [英] TextAppearance in theme

查看:77
本文介绍了主题中的TextAppearance的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将主题中的文本外观设置为TextAppearnance.Large.这是我在styles.xml中正在做的事情(我的应用程序在清单中指向此主题)

I want to set the text appearance in my theme to be TextAppearnance.Large. Here is what I am doing in my styles.xml (my application is pointing to this theme in my manifest)

<style name="myTheme" parent="android:Theme.NoTitleBar.Fullscreen">  
 <item name="android:textAppearance">@android:style/TextAppearance.Large</item>  
</style>

问题:我的文字仍然显示得很小.

Problem: My text is still being displayed small.

问题:

  • 尝试在活动中使用预定义的TextAppearance时我做错了什么?即如何正确指定此TextAppearance?
  • 在哪里定义了TextAppearance.Large/Medium/Small的TextSizes?

推荐答案

首先,将属性声明为

<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>

但是在主题中声明文本外观或文本颜色只会影响绝对没有样式或属性的文本,包括系统定义的样式或属性.如果您添加

But declaring text appearance or text color in a theme only affects text that has absolutely no style or attribute anywhere, including system-defined ones. If you add a

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Medium Text" />

甚至没有Eclipse抛出的 android:textAppearance =?android:attr/textAppearanceMedium" 行,它都会受到此主题的影响,但是按钮等将永远不会受到影响.

without even the android:textAppearance="?android:attr/textAppearanceMedium" line that Eclipse throws in, it will be affected by this theme, but buttons and the like never will.

这篇关于主题中的TextAppearance的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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