Android 3.0 (API level 11) brought with it a whole new animation package, android.animation. It is easier to use and more powerful than the android.view.animation package. It can be used to animate object values and properties as well as views.
This exercise makes use of the ObjectAnimator to set up and trigger a transition animation and the AnimatorListenerAdapter
interface to detect the completion of the animation.
Either using the Graphical Layout menu or by editing the XML directly, edit the following three properties:
android:id="@+id/text_view" android:textSize="26sp" android:layout_marginTop="150dip"
Everything in this example can go straight into the
onCreate()
method. Underneath thesetContentView()
statement add these fields:final TextView textView = (TextView) findViewById(R.id.text_view); ObjectAnimator twirl = ObjectAnimator.ofFloat(textView, "rotation...