Android textAppearance 使用

以往。多个Text我们喜欢使用style 把一个文字的样式抽取出来。然后给其他的text使用

textAppearance顾名思意就是外观的意思。

抽取这个stype不太优雅

于是乎textAppearance 

这个便出现了

    <com.google.android.material.textview.MaterialTextView
        android:id="@+id/shortcut_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginStart="16dp"
        android:textAppearance="@style/Appearance.Text.Subtitle1"
        tools:text="Favorite" />
    <style name="Appearance.Text.Subtitle1" parent="TextAppearance.AppCompat.Subhead">
        <item name="android:textStyle">normal</item>
        <item name="android:textAllCaps">false</item>
        <item name="android:textSize">16sp</item>
        <item name="android:letterSpacing">0.009375</item>
    </style>

猜你喜欢

转载自blog.csdn.net/mp624183768/article/details/124698432