ObjectAnimator属性动画应用demo

感谢慕课网--eclipse_xu
布局文件:activity_main.xml
ObjectAnimator属性动画应用demo
文章图片
ObjectAnimator属性动画应用demo
文章图片

1 6 7 14 15 22 23 30 31 38 39 46 47 54 55 62 63 68 69

View Code 图片资源
ObjectAnimator属性动画应用demo
文章图片

ObjectAnimator属性动画应用demo
文章图片

MainActivity.java
ObjectAnimator属性动画应用demo
文章图片
ObjectAnimator属性动画应用demo
文章图片
1 package com.example.animationapp; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 import android.support.v7.app.ActionBarActivity; 7 import android.animation.ObjectAnimator; 8 import android.os.Bundle; 9 import android.view.Menu; 10 import android.view.MenuItem; 11 import android.view.View; 12 import android.view.View.OnClickListener; 13 import android.view.animation.BounceInterpolator; 14 import android.widget.ImageView; 15 import android.widget.Toast; 16 17 public class MainActivity extends ActionBarActivity implements OnClickListener { 18 19private int[] res = {R.id.im0, R.id.im1,R.id.im2, 20R.id.im3,R.id.im4,R.id.im5,R.id.im6,R.id.im7}; 21 22private Listlist = new ArrayList(); 23 24private boolean flag = true; 25 26@Override 27protected void onCreate(Bundle savedInstanceState) { 28super.onCreate(savedInstanceState); 29setContentView(R.layout.activity_main); 30 31initView(); 32} 33 34private void initView() { 35 36for(int i = 0; i < res.length; i++){ 37ImageView im = (ImageView) findViewById(res[i]); 38im.setOnClickListener(this); 39list.add(im); 40} 41} 42 43@Override 44public void onClick(View v) { 45switch(v.getId()){ 46//im7最后布局,叠加在最上面 47case R.id.im7:{ 48 49if(flag){ 50startAnimation(); 51flag = false; 52}else{ 53closeAnimation(); 54flag = true; 55} 56break; 57} 58 59default: 60Toast.makeText(MainActivity.this, v.getId()+"OK", Toast.LENGTH_SHORT).show(); 61break; 62} 63} 64 65private void closeAnimation() { 66for(int i = 0 ; i
View Code
【ObjectAnimator属性动画应用demo】转载于:https://www.cnblogs.com/gongxing/p/4887303.html

    推荐阅读