Android Animation无限循环动画
方法一:
①参考:http://blog.csdn.net/jiangwei0910410003/article/details/16985999
②anim中主要参数设置
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="1000" android:repeatCount="infinite" android:repeatMode="restart"/> </set>
方法二:
①Animation设置setAnimationListener(new ReStartAnimationListener())
②ReStartAnimationListener()具体实现
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="1000"/> <alpha android:startOffset="3000" android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="1000"/> </set>
/** * 重复启动动画 */ private class ReStartAnimationListener implements Animation.AnimationListener { public void onAnimationEnd(Animation animation) { // TODO Auto-generated method stub animation.reset(); animation.setAnimationListener(new ReStartAnimationListener()); animation.start(); } public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } }