动画的Andr​​oid ImageView的交换机资源 [英] Android ImageView switch resources with animation

查看:78
本文介绍了动画的Andr​​oid ImageView的交换机资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了一个画面一个ImageView的。当用户做一些事情,我想画面切换到另一个资源。

I have an ImageView that has a picture. When the user does something, I want the picture to change to another resource.

我发现这个解决方案:
<一href=\"http://stackoverflow.com/questions/7161500/creating-animation-on-imageview-while-changing-image-resource\">Creating同时改变图像资源上ImageView的动画

I found this solution: Creating animation on ImageView while changing image resource

但是第一淡出当前图像,然后将其在新一变淡。我想的是,在同一时间的第一资源淡出,新图片淡入。

But it first fades out the current picture and then it fades in the new one. What I want is that at the same time the first resource fades out, the new picture to fade in.

我想使用2 ImageViews,一个淡入,另一个淡出。但我不知道是否可使用单个的ImageView来完成。

I was thinking about using 2 ImageViews, one to fade in, another to fade out. But I was wondering if it can be accomplished using a single ImageView.

(我不希望一定是淡入淡出的动画...合并/混合一切将是确定太)

(I don't want necessarily a fade-in fade-out animation... a merge/blend whatever would be ok too)

谢谢!

推荐答案

最后使用ViewFlipper两个图像之间切换。

Finally used a ViewFlipper to switch between the two "images".

<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>

这篇关于动画的Andr​​oid ImageView的交换机资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆