Questions tagged «fadeout»

10
Android使用ImageView淡入和淡出
我正在制作幻灯片时遇到一些麻烦。 我在xml中创建了2个动画,用于淡入和淡出: fadein.xml <?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:interpolator="@android:anim/accelerate_interpolator" android:duration="2000"/> </set> fadeout.xml <?xml version="1.0" encoding="UTF-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:interpolator="@android:anim/accelerate_interpolator" android:duration="2000"/> </set> 我要做的是使用淡入淡出效果从ImageView更改图像,因此当前显示的图像将淡出,而另一幅图像将淡入。考虑到我已经设置了图像,可以不使用此淡出该图像。问题,与此: Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.your_fade_in_anim); imageView.startAnimation(fadeoutAnim); 但是,然后我设置要显示的下一张图像: imageView.setImageBitmap(secondImage); 它只是显示在imageView中,当我设置动画时,它会隐藏图像,然后将其淡入。。。有什么方法可以解决这个问题,我是说,当我执行imageView.setImageBitmap(secondImage);。命令,仅在执行淡入淡出动画时,图像不会立即显示?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.