Android 缺少文本外观。微型样式
据统计,共有4个Android 缺少文本外观。微型样式,android,android-styles,android-textattributes,Android,Android Styles,Android Textattributes,据统计,共有4个TextAppearances(微型、小型、中型、大型) 但Micro没有预定义的样式: ?android:attr/textAppearanceMicro android:style/TextAppearance.Micro 在Android的源代码中找不到它们。我错过了什么?好问题!在研究了一点之后,我没有发现“TextAppearance.Micro”的任何结果 另一方面,我发现与TextAppearances相关的 <style name="TextAppeara
TextAppearance
s(微型、小型、中型、大型)
但Micro没有预定义的样式:
?android:attr/textAppearanceMicro
android:style/TextAppearance.Micro
在Android的源代码中找不到它们。我错过了什么?好问题!在研究了一点之后,我没有发现“TextAppearance.Micro”的任何结果 另一方面,我发现与
TextAppearance
s相关的
<style name="TextAppearance.Small">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?textColorSecondary</item>
</style>
<style name="TextAppearance.Medium">
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.Large">
<item name="android:textSize">22sp</item>
</style>
然后像这样使用它:
<TextView
...
android:textAppearance="@style/TextAppearance.Micro" />
与此相关的是,当我搜索“textAppearanceMicro”时,我在GitHub上发现了3个项目。它们都添加了一些自定义属性,其中一个是
textAppearanceMicro
。此外,他们都在使用ActionBarSherlock
。我不知道textAppearanceMicro
和ActionBarSherlock
之间是否存在连接,但我没有发现该属性在代码中的任何地方使用过。如果您碰巧使用了GoogleAppCompat
库,您可以使用以下内容:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />
谢谢,现在我按照您的建议使用自定义样式。我只是想遵循Android的指导原则,建议只使用这四种Appearanve。因此,第一种选择是使用框架:)似乎很少使用这种外观。
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />