您的位置:首页 > 移动开发 > Android开发

Android 图片翻转动画

2013-02-27 17:21 323 查看
font.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<scale
android:fromXScale="0.0"
android:toXScale="1.0"
android:fromYScale="1.0"
android:toYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="150"/>
</set>

back.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<scale
android:fromXScale="1.0"
android:toXScale="0.0"
android:fromYScale="1.0"
android:toYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="150"/>
</set>
使用:
Animation aniback = AnimationUtils.loadAnimation(getContext(), R.anim.back);
aniback.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationStart(Animation animation)
{
}

@Override
public void onAnimationRepeat(Animation animation)
{
}

@Override
public void onAnimationEnd(Animation animation)
{
if (isCNPic)
{
ivPic.setImageResource(R.drawable.system_tip1);
isCNPic = false;
}
else
{
ivPic.setImageResource(R.drawable.system_tip0);
isCNPic = true;
}
ivPic.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.font));
}
});
ivPic.startAnimation(aniback);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  翻转动画