属性动画
来源:互联网 发布:js排序算法 编辑:程序博客网 时间:2024/05/21 13:23
SplashActivity
public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); ImageView img = (ImageView) findViewById(R.id.img); //属性动画 float translationY = img.getTranslationY(); ObjectAnimator translation = ObjectAnimator.ofFloat(img, "translationY", translationY, 500f); ObjectAnimator alpha = ObjectAnimator.ofFloat(img, "alpha", 0f, 1f); ObjectAnimator rotation = ObjectAnimator.ofFloat(img, "rotation", 0f, 360f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(img, "scaleY", 2f, 1f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(rotation).with(alpha).with(scaleY).with(translation); //设置时间 animatorSet.setDuration(3000); //开始 animatorSet.start(); animatorSet.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { //跳转 Intent intent = new Intent(SplashActivity.this, MainActivity.class); startActivity(intent); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); }}
xml
<ImageView android:id="@+id/img" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:src="@mipmap/ic_launcher" />
更换启动页
阅读全文
0 0
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- last Month
- 两个类具有相同的 XML 类型名称 "{http://service.webservice.base.xm/}searchAccountBatchResponse"。 请使用 @XmlType.na
- PHP的基础整理
- SPSS学习(1)之数据录入与数据获取
- 三种菜单的简单应用
- 属性动画
- screen 使用方法 详解
- QT下载地址
- Reflection2017.12.20
- 关于金融信息系统基础大作业——ATM系统(不限要求)
- 网狐荣耀316版本出现“诈金花下载失败,错误码:7,92的解决办法
- 2017年浙江中医药大学大学生程序设计竞赛-D:CC的神奇背包(思维)
- ObjectAnimator设置动画
- 传统机器视觉相关知识点汇总