android tween动画效果
2023-09-11 14:18:04 时间
anim文件夹下
1 <?xml version="1.0" encoding="utf-8"?> 2 <set xmlns:android="http://schemas.android.com/apk/res/android" 3 android:shareInterpolator="false" > 4 5 <alpha 6 android:duration="1000" 7 android:fromAlpha="1" 8 android:repeatCount="infinite" 9 android:repeatMode="reverse" 10 android:toAlpha="0" /> 11 12 </set>
1 package com.itheima.tween; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.view.View; 6 import android.view.animation.Animation; 7 import android.view.animation.AnimationUtils; 8 import android.widget.ImageView; 9 10 public class MainActivity extends Activity { 11 12 private ImageView imageView; 13 14 @Override 15 protected void onCreate(Bundle savedInstanceState) { 16 super.onCreate(savedInstanceState); 17 setContentView(R.layout.activity_main); 18 imageView = (ImageView) findViewById(R.id.imageView); 19 } 20 21 public void alpha(View v) { 22 Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha); // 加载XML定义动画特效 23 // anim.setFillAfter(true); // 保持结束时的画面 24 imageView.startAnimation(anim); // 应用动画特效 25 } 26 27 public void scale(View v) { 28 Animation anim = AnimationUtils.loadAnimation(this, R.anim.scale); 29 imageView.startAnimation(anim); 30 } 31 32 public void rotate(View v) { 33 Animation anim = AnimationUtils.loadAnimation(this, R.anim.rotate); 34 imageView.startAnimation(anim); 35 } 36 37 public void translate(View v) { 38 Animation anim = AnimationUtils.loadAnimation(this, R.anim.translate); 39 imageView.startAnimation(anim); 40 } 41 42 public void combo(View v) { 43 Animation anim = AnimationUtils.loadAnimation(this, R.anim.combo); 44 imageView.startAnimation(anim); 45 } 46 47 }
相关文章
- DevOps on DevCloud|如何构建Kotlin开发的Android Apps
- Android自定义View 画弧形,文字,并增加动画效果
- Android 深入ViewPager补间动画,实现类京东商城首页广告Banner切换效果
- android 动画基础绘——view 动画
- 【ANDROID游戏开发二十二】(图文详解)游戏中灵活实现动画播放!简述J2ME的游戏类库与ANDROID游戏开发!
- Android动画深入原理分析
- android api (82) —— InputConnection [输入法]
- 熬夜再战Android之修炼Kotlin-【Kotlin的static是什么】
- Android 10 如何在SurfaceFlinger中解决开机动画显示不全问题
- 【Android笔记26】Android中的动画效果之补间动画
- Android 11.0 系统关机动画的功能实现
- Android 9.0 Launcher3仿ios长按app图标实现抖动动画开始拖拽停止动画
- Android 10.0横屏旋转开机动画显示不全的解决方案
- Android 9.0 10.0 去掉开机提示 android is starting 的对话框
- Android下雪动画的实现
- 解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题
- Android 捕获组合键
- android studio1.0 for Mac环境搭建与demo运行(手动下载gradle,科学上google) 转载