将TextSwitcher与自定义字体一起使用

pqn*_*pqn 0 fonts android textview typeface

我想使用a TextSwitcher而不是a TextView因为可用的动画,但是有人知道如何使用自定义Typeface文本吗?我不想使用默认字体.

Ted*_*opp 5

只需android:fontFamily为每个孩子使用该属性TextView.

<TextSwitcher . . .>
    <TextView
        android:fontFamily="..."
        . . . />

    <TextView
        android:fontFamily="..."
        . . . />

</TextSwitcher>
Run Code Online (Sandbox Code Playgroud)

TextSwitcher这两个之间来回转换TextView的孩子,使用字体家族(字体)指定.