【发布时间】:2012-05-08 11:34:53
【问题描述】:
我有一个 ImageSwitcher,我正在使用它来创建幻灯片。 我可以控制图像显示的持续时间,但如何控制图像之间过渡的持续时间。我想增加该持续时间,因为上一张图片的 outAnimation 和下一张图片的 inAnimation 看起来像是合并了,看起来不太好。
【问题讨论】:
标签: android timer slideshow android-image imageswitcher
我有一个 ImageSwitcher,我正在使用它来创建幻灯片。 我可以控制图像显示的持续时间,但如何控制图像之间过渡的持续时间。我想增加该持续时间,因为上一张图片的 outAnimation 和下一张图片的 inAnimation 看起来像是合并了,看起来不太好。
【问题讨论】:
标签: android timer slideshow android-image imageswitcher
为您的 ImageSwitcher 定义自定义进出动画:
ImageSwitcher imageSwitcher = (ImageSwitcher) findViewById(R.id.ImageSwitcher);
imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.custom_fade_in));
imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.custom_fade_out));
并在您的动画 xml 中设置您的持续时间:
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
....
android:duration="1000"/>
</set>
【讨论】: