A (175)

(Tuis.) #1

390 CHAPTER 10: Android Animation: Making Your UI Designs Move


Figure 10-32. Add the xmlns:android and android:interpolator to the parent tag and copy over the tag



  1. In the space between the opening and closing tags, type a
    left-facing chevron character to open the child tag helper dialog, which shows
    five types of Animation class tags which can be child tags to the tag.

  2. Double-click on the child tag, shown highlighted in Figure 1 0-3 1 ,
    and copy the parameters that you used in the anim_andromeda.xml
    RotateAnimation object definition file into the child tag, as shown in
    Figure 10-32.


We will use the same parameters for this tag that we used before, so we can move onto
learning about the other types of transforms, but feel free to experiment with the values that you use
for these parameters, as this is a great way to get a feel for what each of these parameters will do
when you run the application in the AVD.



  1. Next, add a line of space under the tag and use the left-facing
    chevron to popup the helper dialog and double-click on the child
    tag option, or type the opening container characters, to
    prepare to add parameters to the ScaleAnimation object child tag container.
    If you want to see the parameters which are allowed inside of this tag, use the
    android: work process to popup the parameter helper dialog.

  2. Next, you need to add in parameters that scale the animation on the x and y
    axis from 100% (1.0) to 50% (0.5), and back (repeatMode=“reverse”) over a
    4500 -millisecond duration. Set the pivot point to the middle (50%), and set
    a repeatCount of infinite, using the following XML markup parameters, as
    shown in Figure 10-33:


<scale android:fromXScale="1.0" android:toXScale="0.5"
android:fromYScale="1.0" android:toYScale="0.5"
android:pivotX="50%" android:pivotY="50%" android:duration="4500"
android:repeatCount="infinite" android:repeatMode="reverse" />

Free download pdf