本文实例为大家分享了Android Studio实现补间动画的具体代码,供大家参考,具体内容如下补间动画是给出初始位置和结束位置,中间由系统自动补充的动画
1、补间动画的配置文件:scale.xml
2、布局文件:animal_patching.xml
3、main.java
sacle.xml android:toXScale="0.5"android:pivotY="50%"(运动中心位置) android:pivotX="50%"android:fromXScale="1"(初始大小) android:fromYScale="1"/>animal_patchingmain.javapackage com.example.imageview;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;import android.view.View;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {/*private static final String TAG = "leo";private NotificationManager manager;private Notification notification;private PopupWindow popupWindow;//创建一个数组,内部元素为Bean类型;
private List
ImageView imageView = findViewById(R.id.image);
imageView.setOnClickListener(new View.OnClickListener() {@Override public void onClick(View view) {//透明度***********************************// Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.alpad_1);// imageView.startAnimation(animation);//旋转************************************// Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.rotate);// imageView.startAnimation(animation);//大小缩放**********************************// Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.scale);// imageView.startAnimation(animation);//平移************************************Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.translate);imageView.startAnimation(animation);}});
}以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
您可能感兴趣的文章:Android动画系列之帧动画和补间动画的示例代码Android补间动画基本使用(位移、缩放、旋转、透明)
Android实现毛玻璃效果弹出菜单动画Android Flutter绘制有趣的 loading加载动画Android实现多张图片合成加载动画Android 补间动画及组合AnimationSet常用方法详解
