例子一: 补间动画效果,从右进,从左出。
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);
例子二:补间动画效果,渐变。
ImageSwitcher mImageSwitcher = new ImageSwitcher(this); mImageSwitcher.setFactory(this); AlphaAnimation inAnim = new AlphaAnimation(0, 1); inAnim.setDuration(300); mImageSwitcher.setInAnimation(inAnim); AlphaAnimation outAnim = new AlphaAnimation(1, 0); outAnim.setDuration(400); mImageSwitcher.setOutAnimation(outAnim);