Search code examples
androidandroid-theme

Overriding font-size for ?android:attr/textAppearanceSmall


I have been using ?android:attr/textAppearanceSmall and ?android:attr/textAppearanceMedium very frequently in my application. I know that ?android:attr/textAppearanceSmall defaults to font-size 14sp and ?android:attr/textAppearanceMedium defaults to font-size 18sp.

Now, our testing team want the font-size for ?android:attr/textAppearanceSmall to be 16sp. Is there a way, we can override these values so that I don't have to visit screen by screen and line by line to replace them.


Solution

  • In case someone is dealing with similar issue, I just figured out the answer.

    I added following line in my AppTheme

    <item name="android:textAppearanceSmall">@style/AppTheme.TextAppearance.Small</item>
    

    And then I created a new style like

    <style name="AppTheme.TextAppearance.Small" parent="TextAppearance.AppCompat.Small">
        <item name="android:textSize">16sp</item>
    </style>
    

    Thank you