首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >android:theme="@style/AppTheme“中textAppearance的默认值是textAppearanceSmall吗?

android:theme="@style/AppTheme“中textAppearance的默认值是textAppearanceSmall吗?
EN

Stack Overflow用户
提问于 2013-06-06 15:12:31
回答 2查看 10.8K关注 0票数 7

当我创建一个新的android项目时,默认的主题是android:Theme.Light,我发现TextView控件的字体很小,这是否意味着android:theme="@style/AppTheme“中的textAppearance的默认值是textAppearanceSmall?谢谢!

代码语言:javascript
复制
<style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
</style>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-06-06 15:50:52

您可以在默认的styles.xml文件中找到用于所有Android小部件的样式。您可以查看此文件,例如:https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml

或者直接放到你的SDK文件夹中,比如在我的电脑上,你可以在这里找到:D:\Dev\android-sdk\platforms\android-17\data\res\values\styles.xml

您将在此文件中找到TextView的样式定义

代码语言:javascript
复制
<style name="Widget.TextView">
    <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
    <item name="android:textSelectHandleLeft">?android:attr/textSelectHandleLeft</item>
    <item name="android:textSelectHandleRight">?android:attr/textSelectHandleRight</item>
    <item name="android:textSelectHandle">?android:attr/textSelectHandle</item>
    <item name="android:textEditPasteWindowLayout">?android:attr/textEditPasteWindowLayout</item>
    <item name="android:textEditNoPasteWindowLayout">?android:attr/textEditNoPasteWindowLayout</item>
    <item name="android:textEditSidePasteWindowLayout">?android:attr/textEditSidePasteWindowLayout</item>
    <item name="android:textEditSideNoPasteWindowLayout">?android:attr/textEditSideNoPasteWindowLayout</item>
    <item name="android:textEditSuggestionItemLayout">?android:attr/textEditSuggestionItemLayout</item>
    <item name="android:textCursorDrawable">?android:attr/textCursorDrawable</item>
</style>

您可以看到,在这个文件中,默认情况下文本大小是用textAppearanceSmall定义的。

票数 11
EN

Stack Overflow用户

发布于 2013-06-06 15:52:36

TextView不接受默认的textAppearance,默认情况下它被设置为显式地使用textAppearanceSmall

Themes.xml包含定义TextView的缺省样式的以下行

代码语言:javascript
复制
<item name="textViewStyle">@android:style/Widget.TextView</item>

引用的样式包含以下行:

代码语言:javascript
复制
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>

这就是TextView默认使用小文本大小的原因。

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16955866

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档