A (175)

(Tuis.) #1

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


Your frame animation XML definition markup should look like the following:


<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >











Notice that the screen shot in Figure 10-3 shows a fast one second spin rate using a duration value
of 125 milliseconds, while the XML markup above shows the slower two second spin rate, using a
duration value of 250 milliseconds. Play around with this value to achieve the spin rate that you like
best with this animation.


The next thing that you need to do is reference this animation definition file inside of the activity_main.
xml file. Notice that once you do this, your animation will play using only XML; you don’t have to call
a .start( ) method!


Wiring-Up Your Animation: Referencing Your XML


Change the android:layout_height parameter for your second container to wrap_content,
add an android:id=“@+id/llh” so that you can reference it, and add a parent tag on the
outside of the SlidingPaneLayout content pane structure, as is shown in Figure 1 0- 4 , in the top screen.


Figure 10-4. Change the horizontal LinearLayout to wrap_content in the height dimension and add

Free download pdf