Android 中的默认字体特征是什么? [英] What are the default font characteristics in Android ?

查看:29
本文介绍了Android 中的默认字体特征是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以在TypeFace 类中找到字体属性,但是我在Android 中找不到书写的默认特征.我的意思是,如果我使用 TextView 并简单地对其执行 setText("Blabla") ,我会得到什么?px是哪个尺寸?哪种字体?等

I know that fonts properties can be found in the TypeFace class but I can't find the default characteristics of the writing in Android. I mean, if I take a TextView and simply do setText("Blabla") on it, what will I get? Which size in px? Which font? etc.

推荐答案

您可以在此处查看小部件的默认样式:android/res/values/styles.xml

You can check the default style of the widgets here: android/res/values/styles.xml

然后,寻找你到达的Textview

Then, looking for Textview you reach

  <style name="Widget.TextView">    
     <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>    
 </style>

然后稍微研究了一下,发现这个外观是在同一个styles.xml文件中定义的

and after researching a little bit, you find out that this appearance is defined in the same styles.xml file

<style name="TextAppearance.Small">    
 <item name="android:textSize">14sp</item>    
 <item name="android:textStyle">normal</item>    
 <item name="android:textColor">?textColorSecondary</item>    
</style>

哪里

<item name="textColorSecondary">@android:color/secondary_text_dark</item>

这些颜色在/res/color/中定义,检查/res/color/secondary_text_dark.xml

these colors are defined in /res/color/, check /res/color/secondary_text_dark.xml

必须为 android/res/values 文件夹添加书签!

Bookmarking the android/res/values folder is a must!

更新:我的旧链接已损坏,请查看 Github 上的 Android 核心资源文件夹.感谢 kreker 提供链接.

Update: my old links are broken, check Android core resources folder on Github. Thanks to kreker for the link.

这篇关于Android 中的默认字体特征是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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