Android的动画可以是一种动画,也可以多种动画作用于一张图片上,如RotaeAnimation和AlphaAnimation同时放到一个配置文件中

alpha1.xml

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"    android:interpolator="@android:anim/accelerate_interpolator" >    <alpha        android:duration="3000"        android:fromAlpha="1.0"        android:toAlpha="0.0"        android:startOffset="500" />        <rotate        android:duration="3000"        android:fromDegrees="0"        android:pivotX="50%"        android:pivotY="50%"        android:toDegrees="+360" /></set>


package com.example.animation;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.widget.Button;import android.widget.ImageView;import com.example.widgetdemo.R;public class AnimationXmlDemo2 extends Activity{private Button alpha = null;private ImageView image = null;@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.animation_xml2);alpha = (Button) findViewById(R.id.alpha);image = (ImageView) findViewById(R.id.image);alpha.setOnClickListener(new alphaListener());}class alphaListener implements OnClickListener {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubAnimation animation = AnimationUtils.loadAnimation(AnimationXmlDemo2.this, R.anim.alpha1);image.startAnimation(animation);}}}



点击alpha演示看到的效果是图片一边旋转一边消失

源代码下载

点击打开链接

更多相关文章

  1. Android:ImageView如何显示网络图片
  2. Android 在 xml中定义图片
  3. Android ViewFlipper的动画
  4. Android 如何在XML文件中定义动画
  5. Dragger android 的Activity切换动画大全
  6. Android中.9.png图片的使用过程和原理
  7. android动画效果处理
  8. Android之动画效果编程基础

随机推荐

  1. android 照相
  2. Android(安卓)日历开发教程[五]
  3. Android(安卓)Binder机制浅析及AIDL的使
  4. Android(安卓)Studio的使用
  5. Android消息通知-Notification
  6. 使用android快速开发框架afinal的FinalDb
  7. Android下常见的内存泄露 经典
  8. Android(安卓)root权限获取原理详解
  9. Android两种虚拟机区别和联系
  10. Android布局管理器-详细解析布局实现