Android的动画 - 按钮停留点击 [英] Android Animation - Button stays clickable

查看:189
本文介绍了Android的动画 - 按钮停留点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个游戏,我有5个按钮,看起来像云,从天上​​坠落。 这意味着,我的活动开始的时候,'云'都看不出来,因为 marginTop 设置为 -100dp 。 从那个位置他们开始倒下,直到他们迷失在屏幕的底部。

I am making a game in which I have 5 buttons, looking like clouds, falling from the "sky". That means that when my activity starts, 'clouds' cannot be seen, since the marginTop is set to -100dp. From that position they start falling down untill they get lost on the bottom side of the screen.

的事情是,我需要那些按钮来可以点击,动画制作过程中。

The thing is, I need those buttons to be clickable, during the process of animation.

到目前为止,我发现如何我可以使一些文档按钮点击动画后结束。但是,我并不需要这一点。 我需要能够点击通过动画时间本身的按钮。

So far, I found some documentation about how I can make the buttons clickable AFTER the animation ends. But I don't need that. I need to be able to click on the buttons through the animation time itself.

注意:我需要的东西,与3.0版本之前的作品

NOTE: I need something that works with versions before 3.0.

任何人有任何链接到文件或一些示例或什么?

Anybody has any link to documentation or some example or anything ?

推荐答案

之后做一些研究,我发现有两种类型的动画:

After doing some research, I found out that there are two types of animations:

查看动画和临preTY 动画。

视图动画只能动画视图对象。它也缺乏各种动画,因为它只能做的东西,缩放,旋转,移动...它无法改变的背景颜色,例如。 此外,观看动画的dissadvantage是,它只是改变了那里的View对象是 DRAWN 的位置。 Phisically,它仍然停留在相同的位置。 这就是为什么按钮是不可点击,之后观看动画是在它完成了。

The view animation can only animate View objects. It also lack a variety of animations, since it can do only stuff as scale, rotate, move... It cannot change background color, for example. Also, the dissadvantage of the View Animation is that it only change the position of where the View object is DRAWN. Phisically, it still stays in the same position. That's why the button is unclickable, after the View Animation is finished upon it.

属性动画,在另一方面,可以既动画视图和非View对象,它不具有约束的观看动画。 当对象被移动,例如,与属性动画,它们不只是绘制在屏幕上的某些其他位置,但它们实际上的 MOVED

Property Animation, in the other hand, can animate both View and non-View objects and it doesn't have constraints as the View Animation. When objects are moved, for example, with the property animation, they are not just drawn on some other position on the screen, but they are actually MOVED there.

现在,物业动画是一个复杂得多比观看动画写的,所以如果你并不真正需要的属性动画的所有优点,建议使用观看动画。

Now, Property Animation is a lot more complex to write than the View Animation, so if you don't really need all the advantages of the Property Animation, it is suggested to use View Animation.

来源: 地产VS观看动画

教程和SupportLybrary高达API 1: nineoldandroids

Tutorial and SupportLybrary up to API 1: nineoldandroids

这篇关于Android的动画 - 按钮停留点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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