Android的动画切换,而资源的ImageView [英] Android animation while switching imageview resource

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

问题描述

嗯,这是code我用这么老的图像消失(黑色背景)和新的来自外部的幻灯片(从左至右)。

Well this is the code I use to animate the view so that old image disappears (black background) and new one slides in from outside (from left to right).

this.imgView.setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right));

this.imgView.setImageResource(imageArray[next]);

我如何使它的旧形象滑出屏幕前,新出现了。将是巨大的,如果两者都是可见的,但我想这将需要2次切换,所以现在我可以在同一时间坚持一个在屏幕上。

How do I make it that old image slides out of the screen before new one shows up. Would be great if both were visible but I guess that would require 2 views to switch, so for now I could stick to one on screen at a time.

推荐答案

使用ViewFlipper两个ImageView的之间切换:■在同一个活动,并设置幻灯片动画的ViewFlipper。

Use ViewFlipper to switch between two ImageView:s in the same Activity and set a slide animation to the ViewFlipper.

在未来和previous图像视图设置正确的图像资源调用showNext前()和show previous()。

Set correct image resource in the next and previous image view before calling showNext() and showPrevious().

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

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