Android Programming Tutorials

(Romina) #1
Now Your Friends Seem Animated

Figure 45. Patchy with a hidden status entry

Step #3: Fading In and Out


Of course, we have not yet used an animation, which is the point of this


exercise.


First, we need to define our animations. In this case, we will use ones


declared in animation XML files.


Create a Patchy/res/anim directory, then create


Patchy/res/anim/fade_out.xml as follows:


<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="500" />

Also create Patchy/res/anim/fade_in.xml:


268
Free download pdf