What is the optimal way to animate a drawable within a view using the animator classes?
Posted
by
littleFluffyKitty
on Stack Overflow
See other posts from Stack Overflow
or by littleFluffyKitty
Published on 2012-10-31T04:57:57Z
Indexed on
2012/10/31
5:00 UTC
Read the original article
Hit count: 168
I have read about Property Animation and Hardware Acceleration but I am still uncertain what is the most efficient way to use the animator classes. (For the sake of this question I don't need to support devices before Honeycomb. So I want to use the animator classes.)
For example, say I have a View. In this view I have a BitmapDrawable that I want to fade in. There are also many other elements within the view that won't change.
What property or object would be best to use with the animator? The drawable? A paint that I am drawing the bitmap with in onDraw? Something else?
How can this be done to be most efficient with hardware acceleration? Will this require calling invalidate for each step of the animation or is there a way to animate just the drawable and not cause the rest of the view to be redrawn completely for each step of the animation?
I guess I imagine an optimal case would be the rest of the view not having to be completely redrawn in software, but rather hardware acceleration efficiently fading the drawable.
Any suggestions or pointers to recommended approaches?
Thanks!
© Stack Overflow or respective owner