Reputation: 3192
I have a button (button1) and relative layout (rLayout). At start, rLayout is not visible to user. When the button is clicked, I want:
It should be something like SlidingDrawer but not the same thing.
I can do it with TranslateAnimation, AnimationListener and OnClickListener, BUT: my API version is 11 and I read that there are better ways to handle animation since api11. I tried to find examples of what I need, but failed to do so. So my question is: are animation techniques introduced in API 11 better that old ones and how to do what I need with those techniques?
Upvotes: 0
Views: 1012
Reputation: 1006779
are animation techniques introduced in API 11 better that old ones
My impression is that Google will be focusing on optimizing the new animator APIs (e.g., ViewPropertyAnimator
) perhaps more than the legacy animation APIs (e.g., TranslateAnimation
).
how to do what I need with those techniques?
Use ViewPropertyAnimator
, with methods like translateYBy()
. You get a ViewPropertyAnimator
by calling animate()
on a View
, on API Level 11+. If you are supporting older devices, NineOldAndroids offers a near-workalike backport. Here is another SO question and answer that gets into the use of these APIs for sliding fragments around: https://stackoverflow.com/a/12318422/115145
You might also wish to read:
Upvotes: 2