Reputation: 1782
Is there an easy way to implement property animation(e.g. animate "x" or "y" property from value1 to value2) in android < 3.0? I need to animate a visual control(Button or TextView), that needs to handle click events(so, drawable animation is not appropriate).
Update: So, there is a lot of games with animation(Cut the Rope, etc.). How these game developers solved the problem? What the way they use for animation?
Upvotes: 2
Views: 1599
Reputation: 30581
I know this is an old thread, but for those who stumble across this in a Google search, there is a compatibility library available that gives you access to the property animations introduced with Honeycomb all the way back to Android 1.0.
I've used it for some small things, and it works like a charm. http://nineoldandroids.com/
Upvotes: 3
Reputation: 16914
Afaik, for this to work you have to roll your own animation framework first that interpolates the values the way you'd like. Then, you could animate e.g. the margin property of the button with this framework, calling .setLayout() on every tick. This causes the ui-framework to relayout/redraw the whole screen, with the new margin value.
However, this is a terribly slow and wasteful way to animate and I don't recommend it. There might be better solutions.
Upvotes: 1