android
来源:互联网 发布:位面淘宝txt 编辑:程序博客网 时间:2024/06/08 08:05
需求:
启动页:使用属性动画实现,3秒后自动跳转
(渐变、缩放、平移、旋转)
- activity_animation
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/img" android:layout_width="100dp" android:layout_height="100dp" android:layout_centerHorizontal="true" android:src="@mipmap/ic_launcher_round" /></RelativeLayout>
-AnimationActivity
public class AnimationActivity extends AppCompatActivity { private ImageView imageView; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_animation); imageView = (ImageView) findViewById(R.id.img);// 平移 ObjectAnimator translationY = ObjectAnimator.ofFloat(imageView, "translationY", 0, 500f); ObjectAnimator alpha = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1f); ObjectAnimator rotation = ObjectAnimator.ofFloat(imageView, "rotation", 0f, 360f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(imageView, "scaleY", 2f, 1f); ObjectAnimator scaleX = ObjectAnimator.ofFloat(imageView, "scaleX", 2f, 1f); AnimatorSet animSet = new AnimatorSet(); animSet.playTogether(translationY, alpha, rotation, scaleY, scaleX); animSet.setDuration(3000); animSet.start(); new Handler().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(AnimationActivity.this, DetailsActivity.class)); finish(); } }, 3000); }
阅读全文
0 0
- Android
- android
- Android
- android
- android
- Android
- Android
- android
- android
- android
- Android
- Android
- android!!!
- android
- android
- android
- android
- android:
- Linux 下操作gpio(两种方法,驱动和mmap)
- 形态学
- python学习中的乐趣
- 添加验证,根据状态删除
- .classpath和.project的作用
- android
- SylixOS中RPC简介
- spark之dataset基本操作
- skip跳出Maven自定义插件
- 教你如何开发一款实用的完整Android App,附源码
- spring jdbc 使用
- ATPCS 和 AAPCS
- 条款08:别让异常逃离析构函数
- 从开博到现在的情况