覆盖 ?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/textAppearanceSmallfont-size16sp。有没有办法,我们可以覆盖这些值,这样我就不必逐屏逐行访问来替换它们。

如果有人正在处理类似的问题,我只是想出了答案。

我在 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>

谢谢