ysize.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:startOffset="0"
android:repeatMode="reverse"
android:fillAfter="false"
android:shareInterpolator="@android:interpolator/linear"
>
<scale
android:pivotY="50%"
android:fromYScale="10dp"
android:fromXScale="1"
android:toXScale="1"
android:toYScale="40dp"
android:repeatCount="infinite"
android:duration="480"
>
</scale>
</set>
MainActivity.java
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
Animation input_v1;
ImageView in_v1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
input_v1 = AnimationUtils.loadAnimation(this,R.anim.ysize); //Animation initialization
in_v1 = findViewById(R.id.i_v1); //image,textview,button initialization
in_v1.startAnimation(input_v1); //Start animation
}
}
上面的代码工作并启动Animation。
但我想停止播放此动画。
动画的其他重要功能
它对我有用。
in1_v.clearAnimation(); //Stop animation
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句