xml中定义属性动画
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator android:duration="1000" android:propertyName="scaleX" android:valueFrom="1.0" android:valueTo="2.0" android:valueType="floatType"> </objectAnimator> <objectAnimator android:duration="1000" android:propertyName="scaleY" android:valueFrom="1.0" android:valueTo="2.0" android:valueType="floatType"> </objectAnimator> <objectAnimator android:duration="1000" android:propertyName="alpha" android:valueFrom="0.1" android:valueTo="1" android:valueType="floatType"> </objectAnimator> </set>
private void animatorXml(){ Animator animator = AnimatorInflater.loadAnimator(this,R.animator.scale_animator); animator.setTarget(mImage); animator.start(); }原文链接:https://www.f2er.com/xml/294881.html