Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parent style for TextView style with AppCompat usage

What parent style should I use if I want to set global textViewStyle and maintain backward compatibility with AppCompat? I can't find something like Widget.AppCompat.TextView :

<style name="Base_AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="android:textViewStyle">@style/GlobalTextViewStyle</item>

</style>

<style name="GlobalTextViewStyle" parent="?????">
    <item name="android:textAppearance">@style/TextAppearance.AppCompat.Medium</item>
</style>
like image 419
AppiDevo Avatar asked Dec 24 '22 18:12

AppiDevo


1 Answers

You just need to extend TextAppearance.AppCompat style overriding necessary values:

<style name="Base_AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="android:textAppearance">@style/MyTextAppearance</item>

</style>

<style name="MyTextAppearance" parent="TextAppearance.AppCompat">
        <item name="android:textColor">?android:textColorPrimary</item>
        <item name="android:textColorHint">?android:textColorHint</item>
        <item name="android:textColorHighlight">?android:textColorHighlight</item>
        <item name="android:textColorLink">?android:textColorLink</item>
        <item name="android:textSize">@dimen/abc_text_size_body_1_material</item>
        <item name="textColor">?textColorPrimary</item>
        <item name="textColorHighlight">?textColorHighlight</item>
        <item name="textColorHint">?textColorHint</item>
        <item name="textColorLink">?textColorLink</item>
        <item name="textSize">16sp</item>
        <item name="textStyle">normal</item>
</style>
like image 197
azizbekian Avatar answered Dec 31 '22 14:12

azizbekian