文档(或任何人)是否谈论默认
的dpi值android:textAppearance="?android:attr/textAppearanceLarge"
} android:textAppearance="?android:attr/textAppearanceMedium"
} android:textAppearance="?android:attr/textAppearanceSmall"
} 小部件?
换句话说,我们可以在不使用android:textAppearance
属性的情况下复制这些文字视图的外观吗?
答案 0 :(得分:279)
在android sdk目录中查看。
在\platforms\android-X\data\res\values\themes.xml
:
<item name="textAppearanceLarge">@android:style/TextAppearance.Large</item>
<item name="textAppearanceMedium">@android:style/TextAppearance.Medium</item>
<item name="textAppearanceSmall">@android:style/TextAppearance.Small</item>
在\platforms\android-X\data\res\values\styles.xml
:
<style name="TextAppearance.Large">
<item name="android:textSize">22sp</item>
</style>
<style name="TextAppearance.Medium">
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.Small">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?textColorSecondary</item>
</style>
TextAppearance.Large
表示样式继承自TextAppearance
样式,如果要查看样式的完整定义,还必须跟踪样式。
链接:http://developer.android.com/design/style/typography.html
答案 1 :(得分:16)
换句话说,我们可以在不使用android:textAppearance属性的情况下复制这些文本视图的外观吗?
就像biegleux已经说过:
如果您想在Android应用中的任何文字上使用小,中等或大值,您只需创建一个{ {1}}文件夹中的{1}}文件,并使用以下3行定义文本大小:
dimens.xml
以下是values
文件中带有大文本的TextView示例:
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_medium">18sp</dimen>
<dimen name="text_size_large">22sp</dimen>
答案 2 :(得分:8)
以编程方式,您可以使用:
textView.setTextAppearance(android.R.style.TextAppearance_Large);