0
android:propertyName="scaleX"
코드 줄을 android:propertyName="alpha"
으로 변경하면 애니메이션이 작동하지 않습니다!Android objectAnimator set propertyValuesHolder
코드
AnimatedVectorDrawableCompat mAnimatedVectorDrawable = AnimatedVectorDrawableCompat.create(
getApplication(), R.drawable.v_frame_animation
);
image.setImageDrawable(mAnimatedVectorDrawable);
if (mAnimatedVectorDrawable != null) {
mAnimatedVectorDrawable.start();
}
애니메이터/v_frame_animation.xml
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:drawable="@drawable/gears_copy">
<target
android:name="vaaa"
android:animation="@animator/heart_frame_animator" />
</animated-vector>
애니메이터/heart_frame_animator.xml
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="5000"
android:repeatCount="infinite"
android:valueType="floatType">
<propertyValuesHolder
android:propertyName="scaleX"
android:valueType="floatType">
<keyframe
android:fraction="0"
android:interpolator="@android:anim/accelerate_interpolator"
android:value="0" />
<keyframe
android:fraction=".5"
android:interpolator="@android:anim/accelerate_interpolator"
android:value="1" />
<keyframe
android:fraction="1"
android:interpolator="@android:anim/accelerate_interpolator"
android:value="0" />
</propertyValuesHolder>
</objectAnimator>
"fillAlpha"속성 이름을 사용해 볼 수 있습니까? – GaborNovak