How to use vector drawables with View besides ImageView with srcCompat?

后端 未结 9 955
旧巷少年郎
旧巷少年郎 2020-12-13 03:45

app:srcCompat with ImageView allows for backward compatible use of vector drawables. But how can you use them with other Views besides

9条回答
  •  無奈伤痛
    2020-12-13 04:20

    set vector drawable to side drawable in textview in android

    AppCompatTextView now supports app:drawableLeftCompat, app:drawableTopCompat, app:drawableRightCompat, app:drawableBottomCompat, app:drawableStartCompat and app:drawableEndCompat compound drawables, supporting backported drawable types such as VectorDrawableCompat.

    Include this in your gradle file

    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    

    In your text view you can use

    app:drawableLeftCompat
    app:drawableStartCompat
    

提交回复
热议问题