Search code examples
androidandroid-vectordrawable

Alpha animator to a group element in AnimatedVectorDrawable


Is it possible to apply an alpha animator to a <group> element instead of whole <vector> element in an AnimatedVectorDrawable? If not, is there any alternative to this ?


Solution

  • No, the <group> element doesn't have an alpha property.

    As per the VectorDrawable documentation, the parts of the VectorDrawable with alpha are the whole <vector> which has android:alpha and the <path> which has android:strokeAlpha and android:fillAlpha.

    So if you want to animate the alpha of only part of the VectorDrawable you should animate the fillAlpha and/or strokeAlpha of the relevant paths.