-------------------------

-----------旋转+反转

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

<rotate
android:repeatCount="10"
android:repeatMode="reverse"
android:duration="8000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" >
</rotate>

</set>

-------------颜色亮到透明 反复
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="
http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >

<alpha
android:duration="3000"
android:fromAlpha="0.2"
android:repeatCount="10"
android:repeatMode="reverse"
android:toAlpha="1.0" />

</set>

--------------------------------.java

package gongzibai.co.cc;

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;

public class Animation1Activity extends
Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ImageView mImageView = (ImageView) findViewById(R.id.imageView1);
mImageView
.setImageResource(R.drawable.icon);

findViewById(R.id.button15)
.setOnClickListener(
new OnClickListener() {

@Override
public void onClick(
View v) {
// TODO Auto-generated method stub
final Animation animation2 = AnimationUtils
.loadAnimation(
Animation1Activity.this,
R.anim.setanimation1);

//mimageviewadd animation

mImageView
.startAnimation(animation2);

}
});
findViewById(R.id.button2)
.setOnClickListener(
new OnClickListener() {

@Override
public void onClick(
View v) {
// TODO Auto-generated method stub

final Animation animation1 = AnimationUtils
.loadAnimation(
Animation1Activity.this,
R.anim.setanimation);
mImageView
.startAnimation(animation1);

}
});

findViewById(R.id.button3)
.setOnClickListener(
new OnClickListener() {

@Override
public void onClick(
View v) {
// TODO Auto-generated method stub

final Animation animation2 = AnimationUtils
.loadAnimation(
Animation1Activity.this,
R.anim.setanimation2);
mImageView
.startAnimation(animation2);

}
});

findViewById(R.id.button4)
.setOnClickListener(
new OnClickListener() {

@Override
public void onClick(
View v) {
new AnimationUtils();
// TODO Auto-generated method stub
final Animation animation3 = AnimationUtils
.loadAnimation(
Animation1Activity.this,
R.anim.alpha_animation);
mImageView
.startAnimation(animation3);

}
});
}
}

-----------------------

-----


--------------FRAMEANIMATION自动运行

// auto run--->hasfocus--->onwindowfocusChanged...
@Override
public void onWindowFocusChanged(
boolean hasFocus) {
// TODO Auto-generated method stub
if (hasFocus) {
fireanimation.start();

} else {
fireanimation.stop();
}
super.onWindowFocusChanged(hasFocus);
}
------------
-------------.java
mImageView
.setBackgroundResource

(R.anim.fireanim);

fireanimation = (AnimationDrawable) mImageView
.getBackground();
---------<?xml version="1.0" encoding="UTF-8"?>

// add <animation-list> </animation-list>

//add <item>
<animation-list

xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true" >

<item
android:drawable="@drawable/fire01"
android:duration="100"/>

<item
android:drawable="@drawable/fire02"
android:duration="600"/>
</animation-list>

-----------XML里的IMAGEVIEW不能加载图片,否则,FRAMEANIMATION无效果...

更多相关文章

  1. Android实现加载等待展示
  2. Android的supportV7中默认按钮的颜色设置
  3. android Activity加载完成后的监听事件
  4. 72、android状态栏一体化,状态栏改变颜色
  5. 关于android示例程序(bitmapfun)——高效加载图片的坑爹地方
  6. 安卓 WebView加载本地图片时居中显示
  7. [Android]Menu/Button 英文全大写、Menu改变字体颜色

随机推荐

  1. 设置 quick-cocos2d-x 在 Mac 下的编译环
  2. android 如何中断一个子线程
  3. Android(安卓)高级编程--Fragment理解与
  4. Android(安卓)Webview 使用Html播放音频
  5. Java序列化反序列化、Serializable、Parc
  6. WhaleCTF平台Android部分题解
  7. Android(安卓)ApiDemos示例解析(45):App->
  8. Android(安卓)Studio断点调试三(深入研究)
  9. 【Android】入门案例(一)——简单登录
  10. 了解Android(安卓)Studio jniLibs目录