Android's built-in tweening (or more correctly inbetweening) functions are often overlooked as being unable to produce more than simple translations but the android.view.animation
package allows us to fade, stretch, and rotate the contents of a view and to combine these effects with each other and also a neat speed interpolator. Furthermore, tweening is often easier on system resources than the direct manipulation of bitmaps and drawables.
When possible, tween animations are best defined in XML. Start up a new Android project in Eclipse and create a new folder named anim
inside the res
folder.
In the
res/anim
folder create a New Android XML file calledmy_tween_anim.xml
:If you used the New wizard to create the file and selected set as the root element, the file should look something like this:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> </set>
We want our graphic...