废话不说,上代码:

1、要关闭的Activity代码:

public class TVOffDemo extends Activity {/** Called when the activity is first created. */public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);Button b = (Button) findViewById(R.id.Button01);b.setOnClickListener(new OnClickListener() {public void onClick(View v) {View img = findViewById(R.id.layout);img.startAnimation(new TVOffAnimation());}});}}


2、动画实现类TVOffAnimation 

public class TVOffAnimation extends Animation {private int halfWidth;private int halfHeight;public void initialize(int width, int height, int parentWidth, int parentHeight) {super.initialize(width, height, parentWidth, parentHeight);setDuration(500);setFillAfter(true);// 保存View的中心点halfWidth = width / 2;halfHeight = height / 2;setInterpolator(new AccelerateDecelerateInterpolator());}protected void applyTransformation(float interpolatedTime, Transformation t) {final Matrix matrix = t.getMatrix();if (interpolatedTime < 0.8) {matrix.preScale(1 + 0.625f * interpolatedTime, 1 - interpolatedTime / 0.8f + 0.01f,halfWidth, halfHeight);} else {matrix.preScale(7.5f * (1 - interpolatedTime), 0.01f, halfWidth, halfHeight);}}}

下面上源码:

更多相关文章

  1. Android剪切板用法
  2. Android(安卓)AIDL实现跨进程Activity与Service的通信
  3. android 开发技巧(13)--处理空列表
  4. Android(安卓)Studio 快捷键使用
  5. android获取今天周几的示例
  6. [原创]Android(安卓)init.rc文件解析过程详解(二)
  7. android 取消edittext自动获取焦点弹出输入法
  8. Android学习笔记_31_通过后台代码生成View对象以及动态加载XML布
  9. 两分钟彻底让你明白Android(安卓)Activity生命周期(图文)!

随机推荐

  1. android Handler 机制研究学习笔记
  2. Android原生(Native)C开发之二 framebuff
  3. android BaseAdapter优化
  4. Android中图片占用内存的计算
  5. Android 事件分发机制
  6. android中的sqlite数据库加密
  7. android source code online
  8. 在Android中使用Handler和Thread线程执行
  9. Android ImageView 总结【转载】
  10. Android ImageView图片显示点击背景切换