Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

android animations pdf by apk855


Android tutorial with full Example, including Android UI Controls, layouts, Common application and Some FAQs, Android hello world example, android activity example, android source code to Eclipse IDE, button,textbox, password, checkbox, spinner,date picker, time picker, alert box, custom dialog, toast, imageview, imagebutton, LinearLayout, RelativeLayout, TableLayout, ListView, Gridview, Webview

More Info

                       Copyright © 2012, All rights
     • The Android framework provides two animation
         property animation (introduced in Android 3.0).
         view animation.
     • Both animation systems are viable options, but the
       property animation system, in general, is the preferred
       method to use.
     • Because it is more flexible and offers more features.
     • In addition to these two systems, you can utilize
       Drawable animation, which allows you to load
       drawable resources and display them one frame after

                                          Copyright © 2012, All rights
     • The view animation system provides the capability to
       only animate View objects.
     • so if you wanted to animate non-View objects, you
       have to implement your own code to do so.
     • The view animation system is also constrained in the
       fact that it only exposes a few aspects of a View
       object to animate, such as the scaling and rotation of
       a View but not the background color, for instance.
     • Another disadvantage of the view animation system
       is that it only modified where the View was drawn,
       and not the actual View itself.
     • For instance, if you animated a button to move
       across the screen, the button draws correctly, but
       the actual location where you can click the button
       does not change, so you have to implement your
       own logic to handle this.
                                          Copyright © 2012, All rights
     • With the property animation system, these
       constraints are completely removed.
     • you can animate any property of any object (Views
       and non-Views) and the object itself is actually
     • The property animation system is also more robust
       in the way it carries out animation.
     • At a high level, you assign animators to the
       properties that you want to animate, such as color,
       position, or size and can define aspects of the
       animation such as interpolation and synchronization
       of multiple animators.
     • It also might make sense to use both animation
       systems for different situations if the use case
                                        Copyright © 2012, All rights
                         View Animation

     • We use View Animation system to perform tweened
       animation on Views.
     • Tween animation calculates the animation with
       information such as the start point, end point, size,
       rotation and other common aspects of an animation.
     • A tween animation can a series of simple
       transformations on the contents of a View object.
     • If you a TextView object, you can move , rotate, grow,
       or shrink the text.
     • If it having a background image , the image will be
       transformed along with the text.
     • The android.view.animation package provides the
       classes for tweened animations.
                                          Copyright © 2012, All rights
     • To perform a tween animation we need to defines the
       instructions either by .XML file or Android Code.
     • As we work with the layout, .xml file gives you the
       flexibility and readability.
     • The animation instructions (transformations )are
       either sequential or simultaneous.
     • Each transformation takes           a set of specific
       parameters .
     • To     make      several     transformations  happen
       simultaneously, give them the same start time; to
       make them sequential, calculate the start time plus
       the duration of the preceding transformation.

                                         Copyright © 2012, All rights
     • The animation xml file belongs in the res/anim/
       directory of your android project.
     • The file must have a single root element <set>.
     • The child element may be
     • The <set> may contain one more <set> element.
     • By default, all animation instructions are applied
     • To make them occur sequentially, you must specify
       the startOffSet attribute.
     • The following .xml file is used to stretch, then
       simultaneously spin and rotate a View Object.

                                         Copyright © 2012, All rights
       <set android:shareInterpolator="false">
              android:fromXScale="1.0”         android:toXScale="1.4"
              android:fromYScale="1.0”         android:toYScale="0.6"
              android:pivotX="50%“            android:pivotY="50%"
              android:fillAfter="false“       android:duration="700" />
                android:fromXScale="1.4“           android:toXScale="0.0"
                android:fromYScale="0.6“           android:toYScale="0.0"
                android:pivotX="50%”              android:pivotY="50%"
                android:startOffset="700“         android:duration="400"
                android:fillBefore="false" />
                android:fromDegrees="0“            android:toDegrees="-45"
                android:toYScale="0.0“            android:pivotX="50%"
                android:pivotY="50%“             android:startOffset="700"
                android:duration="400" />
                                                Copyright © 2012, All rights
                              Activity file

  • To apply the above animations, we use the following
    java code .

  •   ImageView image = (ImageView) findViewById(;
      Animation hyperspaceJumpAnimation =

  • As an alternative to startAnimation(), we can setup the
    starting time .

                                              Copyright © 2012, All rights

     • By using PropertyAnimation , You can define an
       animation to change any object property over time.
     • To animate anything, we specify the following
               The object property that you want to animate.
               Object’s position on the screen.
               How long you want to animate the object.
               What values you want to animate in between.
     • The property animation system lets you define the
       following characteristics of the animation:
           Duration : Specifies the duration of an animation. The
                       default duration length is 300ms.
           Time Interpolation : You can specify how the values for the
                                 property are calculated as a function of
                                 the animation’s current elapsed time.
                                                      Copyright © 2012, All rights
     • Repeat count and behavior: specifies whether the
                      animation is to be repeated or not.
                      And if it is repeated how many no of
                      times it should repeated.

     • Animator Sets: You can group animation into
                      logical sets that play together or

     • FrameRefreshDelay : specifies how often to refresh
                     frames of your animation.

                                          Copyright © 2012, All rights

To top