例子一: 补间动画效果,从右进,从左出。
ImageSwitcher mImageSwitcher = new ImageSwitcher(this);
mImageSwitcher.setFactory(this); mImageSwitcher.setInAnimation(this, R.anim.slide_big_in_right);
mImageSwitcher.setOutAnimation(this, R.anim.slide_big_out_right);
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta=""
android:toXDelta=""
android:fromYDelta=""
android:toYDelta=""
android:duration=""
android:interpolator="@android:anim/decelerate_interpolator" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta=""
android:toXDelta="-1920"
android:fromYDelta=""
android:toYDelta=""
android:duration=""
android:interpolator="@android:anim/decelerate_interpolator" />
</set>
例子二:补间动画效果,渐变。
ImageSwitcher mImageSwitcher = new ImageSwitcher(this);
mImageSwitcher.setFactory(this); AlphaAnimation inAnim = new AlphaAnimation(, );
inAnim.setDuration();
mImageSwitcher.setInAnimation(inAnim);
AlphaAnimation outAnim = new AlphaAnimation(, );
outAnim.setDuration();
mImageSwitcher.setOutAnimation(outAnim);