tween

xml 代码如下:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">


<!-- 透明动画 -->


<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="5000"/>




<!-- 旋转动画效果 -->
<rotate
android:duration="5000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="90" />

<scale
android:fromXScale="1.4"
android:toXScale="0.0"
android:fromYScale="0.6"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="5000" />

<translate
android:fromXDelta="0"
android:fromYDelta="0"
android:toXDelta="100"
android:toYDelta="100"
android:duration="5000" />

</set>

/**

*
* 1 propertyAnimation
*
* 2 viewAnimation
*
* 2.1tween animation
*
* 常用的几种动画有:
*
* alpha透明动画效果
*
* android:fromAlpha
*
* Float. Starting opacity offset, where 0.0 is transparent and 1.0 is opaque.
*
* android:toAlpha
*
* Float. Ending opacity offset, where 0.0 is transparent and 1.0 is opaque.
*
* scale缩放动画效果
*
* translate平移动画效果
*
* rotate旋转动画效果
*/


@SuppressWarnings("unused")
private void tweenAnim() {


// 方式一: xml方式定义,放在res/anim/xxx.xml
// Animation animation = AnimationUtils.loadAnimation(this, R.anim.alpha);
// img_main.startAnimation(animation);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump);
img_main.startAnimation(animation);
// 方式二:代码实现
// Animation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
// img_main.startAnimation(alphaAnimation);


// 其他效果同上
}

frame

<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android"    android:oneshot="false">    <item android:drawable="@drawable/rocket_thrust1" android:duration="200" />    <item android:drawable="@drawable/rocket_thrust2" android:duration="200" />    <item android:drawable="@drawable/rocket_thrust3" android:duration="200" /></animation-list>

ImageView rocketImage = (ImageView) findViewById(R.id.rocket_image);rocketImage.setBackgroundResource(R.drawable.rocket_thrust);rocketAnimation = (AnimationDrawable) rocketImage.getBackground();rocketAnimation.start();

更多相关文章

  1. android 实现qq聊天对话界面效果
  2. Activity切换动画无效(android:windowIsTranslucent)影响(androi
  3. Android 动画旋转效果
  4. Android 麦克风录音动画
  5. android添加桌面快捷方式
  6. 【Android】跑马灯效果(文字滚动)
  7. Android TextView实现跑马灯效果
  8. android基础知识03——事件处理01:主要事件及其处理方式
  9. android知识小点:文字阴影效果

随机推荐

  1. 爱Android更要懂Android
  2. 关于Android NDK中如何调用第三方静态库-
  3. 最牛逼android上的图表库MpChart(三) 条形
  4. android坐标系相关知识点
  5. Android技术人才前途无量
  6. 7GB! | 高焕堂Android从程序员到架构师之
  7. 深入理解Android音频框架AudioTrack到Aud
  8. Android(Java):对应用进行单元测试
  9. 移动互联网应用技术架构简介-Android
  10. android之Intent基本使用