覆盖 ?android:attr/textAppearanceSmall 的字体大小
Overriding font-size for ?android:attr/textAppearanceSmall
我在我的应用程序中经常使用 ?android:attr/textAppearanceSmall
和 ?android:attr/textAppearanceMedium
。我知道 ?android:attr/textAppearanceSmall
默认为 font-size
14sp
而 ?android:attr/textAppearanceMedium
默认为 font-size
18sp
.
现在,我们的测试团队希望 ?android:attr/textAppearanceSmall
的 font-size
为 16sp
。有没有办法,我们可以覆盖这些值,这样我就不必逐屏逐行访问来替换它们。
如果有人正在处理类似的问题,我只是想出了答案。
我在 AppTheme
中添加了以下行
<item name="android:textAppearanceSmall">@style/AppTheme.TextAppearance.Small</item>
然后我创建了一个新的style
喜欢
<style name="AppTheme.TextAppearance.Small" parent="TextAppearance.AppCompat.Small">
<item name="android:textSize">16sp</item>
</style>
谢谢
我在我的应用程序中经常使用 ?android:attr/textAppearanceSmall
和 ?android:attr/textAppearanceMedium
。我知道 ?android:attr/textAppearanceSmall
默认为 font-size
14sp
而 ?android:attr/textAppearanceMedium
默认为 font-size
18sp
.
现在,我们的测试团队希望 ?android:attr/textAppearanceSmall
的 font-size
为 16sp
。有没有办法,我们可以覆盖这些值,这样我就不必逐屏逐行访问来替换它们。
如果有人正在处理类似的问题,我只是想出了答案。
我在 AppTheme
<item name="android:textAppearanceSmall">@style/AppTheme.TextAppearance.Small</item>
然后我创建了一个新的style
喜欢
<style name="AppTheme.TextAppearance.Small" parent="TextAppearance.AppCompat.Small">
<item name="android:textSize">16sp</item>
</style>
谢谢