安卓——animotion

  1. 在 layout下建立文件夹 animator写入动画文件xml
<?xml version="1.0" encoding="utf-8"?>
<!--<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:duration="3000"-->
<!--android:propertyName="textSize"-->
<!--android:valueType="floatType"-->
<!--android:valueFrom="10.0"-->
<!--android:valueTo="40.0"-->
<!--android:repeatCount="-1"-->
<!--android:repeatMode="reverse"-->
<!--/>-->
<!--<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:duration="3000"-->
<!--android:propertyName="alpha"-->
<!--android:valueType="floatType"-->
<!--android:valueFrom="0.0"-->
<!--android:valueTo="1.0"-->
<!--android:repeatCount="-1"-->
<!--android:repeatMode="reverse" />-->

<!--<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:duration="3000"-->
<!--android:propertyName="translationX"-->
<!--android:valueType="floatType"-->
<!--android:valueFrom="0.0"-->
<!--android:valueTo="300.0"-->
<!--android:repeatCount="-1"-->
<!--android:repeatMode="reverse" />-->
<!--<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:duration="3000"-->
<!--android:propertyName="rotation"-->
<!--android:valueType="floatType"-->
<!--android:valueFrom="0.0"-->
<!--android:valueTo="360.0"-->
<!--android:repeatCount="-1"-->
<!--android:repeatMode="restart" />-->

<!--<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:duration="3000"-->
<!--android:propertyName="scaleX"-->
<!--android:valueType="floatType"-->
<!--android:valueFrom="0.0"-->
<!--android:valueTo="2.0"-->
<!--android:repeatCount="-1"-->
<!--android:repeatMode="reverse" />-->



<!--android:translationX=""-->
<!--android:alpha=""-->
<!--android:rotation=""-->
<!--android:scaleX=""-->

<set android:ordering="together"
xmlns:android="http://schemas.android.com/apk/res/android">

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:propertyName="rotationY"
android:valueType="floatType"
android:valueFrom="0.0"
android:valueTo="360.0"
android:repeatCount="-1"
android:repeatMode="restart" />

<!--<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:duration="3000"-->
<!--android:propertyName="translationY"-->
<!--android:valueType="floatType"-->
<!--android:valueFrom="0.0"-->
<!--android:valueTo="300.0"-->
<!--android:repeatCount="-1"-->
<!--android:repeatMode="reverse" />-->

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="3000"
android:propertyName="textSize"
android:valueType="floatType"
android:valueFrom="10.0"
android:valueTo="16.0"
android:repeatCount="-1"
android:repeatMode="reverse"
/>

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:propertyName="textColor"
android:valueType="colorType"
android:valueFrom="#95868686"
android:valueTo="#951455ed"
android:repeatCount="-1"
android:repeatMode="reverse"
/>

</set>





2. JAVA加载
tv=(TextView) findViewById(R.id.tv);
// 1 context
Animator animator= AnimatorInflater.loadAnimator(MainActivity.this,R.animator.animator);
animator.setTarget(tv);
animator.start();
原文地址:https://www.cnblogs.com/embaobao/p/10720862.html