android - Add ObjectAnimator to AnimatedVectorDrawable at runtime -
i'm able change fillcolor of animatedvectordrawable using xml files.
<?xml version="1.0" encoding="utf-8"?> <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/my_svg"> <target android:animation="@animator/myanimator" android:name="color" /> </animated-vector> <?xml version="1.0" encoding="utf-8"?> <set> <objectanimator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="3000" android:propertyname="fillcolor" android:valuetype="inttype" android:interpolator="@android:interpolator/decelerate_cubic" android:valuefrom="@color/blue" android:valueto="@color/green" /> </set>
mimageview = (imageview)findviewbyid(r.id.imageview); drawable drawable = mimageview.getdrawable(); if (drawable instanceof animatable) { ((animatable) drawable).start(); }
but there way change color @ runtime?
Comments
Post a Comment