我有一张有图片的ImageView。当用户执行某些操作时,我希望图片更改为其他资源。
我找到了这个解决方案: Creating animation on ImageView while changing image resource
但它首先淡出当前的图片然后在新图片中消失。我想要的是,在第一个资源消失的同时,新图片将逐渐消失。
我正在考虑使用2个ImageViews,一个淡入淡出,另一个淡出淡出。但我想知道是否可以使用单个ImageView来完成。
(我不一定想要一个淡入淡出动画......合并/混合任何一切都可以)
谢谢!
答案 0 :(得分:0)
最后使用ViewFlipper在两个“图像”之间切换。
<ViewFlipper
android:id="@+id/view_flipper"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/background_level"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/background_level_1" />
<ImageView
android:id="@+id/background_level_flip1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/background_level_2" />
</ViewFlipper>