Thursday, July 11, 2013

Android Animation Tutorial

We can animate all the views like Layouts, TextViews,ImageViews, Buttons etc. Animation makes the GUI  more interactive and enhance User Experience.

Android offers two kinds of animation:
Frame-by-Frame Animations are  Traditional cell-based animations in which a different Drawable
is displayed in each frame. Frame-by-frame animations are displayed within a View,
using its Canvas as a projection screen.
Tweened Animations Tweened animations are applied to Views, letting you define a series
of changes in position, size, rotation, and opacity that animate the View contents.

Note: Both animation types are restricted to the original bounds of the View they’re  applied to.   Rotations, translations, and scaling transformations that extend beyond
the original boundaries of the View will result in the contents being clipped.

 Tweened Animations

Tweened animations offer a simple way to provide depth, movement, or feedback to your users at a
minimal resource cost.
Using animations to apply a set of orientation, scale, position, and opacity changes is much less
resource-intensive than manually redrawing the Canvas to achieve similar effects, not to mention far
simpler to implement.

Tweened animations are commonly used to:
➤ Transition between Activities.
➤ Transition between layouts within an Activity.
➤ Transition between different content displayed within the same View.
➤ Provide user feedback such as:
➤ Indicating progress.
➤ ‘‘Shaking’’ an input box to indicate an incorrect or invalid data entry.
Creating Tweened Animations
Tweened animations are created using the Animation class. The following list explains the animation
types available.
➤ AlphaAnimation Lets you animate a change in the View’s transparency (opacity or alpha
➤ RotateAnimation Lets you spin the selected View canvas in the XY plane.
➤ ScaleAnimation Allows you to zoom in to or out from the selected View.
➤ TranslateAnimation Lets you move the selected View around the screen (although it will
only be drawn within its original bounds).

Android offers the AnimationSet class to group and configure animations to be run as a set. You can
define the start time and duration of each animation used within a set to control the timing and order
of the animation sequence.
It’s important to set the start offset and duration for each child animation, or they will all start and complete at the same time.

Animating Layouts and View Groups

A LayoutAnimation is used to animate View Groups, applying a single Animation (or Animation Set)
to each child View in a predetermined sequence.
Use a LayoutAnimationController to specify an Animation (or Animation Set) that’s applied to each
child View in a View Group. Each View it contains will have the same animation applied, but you can
use the Layout Animation Controller to specify the order and start time for each View.
Android includes two LayoutAnimationController classes.
LayoutAnimationController Lets you select the start offset of each View (in milliseconds)
and the order (forward, reverse, and random) to apply the animation to each child View.
GridLayoutAnimationController Is a derived class that lets you assign the animation
sequence of the child Views using grid row and column references.

Following are Examples of Animating diffrent types of Views

Android Animation Examples:

Animating  ImageViews

Layout Animations


  1. I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!

  2. This post is really useful and helpful to know more about the things which you have shared. I appreciate you for such a great amount of information. I assure this would be beneficial for many people. Online Animation Courses Trivandrum

  3. provides authentic IT Certification exams preparation material guaranteed to make you pass in the first attempt, this is the right platform where you can get exact 7392X exam questions answers.

  4. Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks Collective conscious

  5. I like this post, enjoyed this one thanks for posting . top logo designers

  6. Movie buffs fashion themselves to be quite the astute individuals, a beautiful combination of intelligence, taste, and an appreciation of all this artistic. It is quite the event when one movie aficionado finds themselves face-to-face with their match. As with any couple, finding things in common is a major key to having a great relationship, but for movie lovers, the innate power of cinema and appreciation for the celluloid arts makes for a highly combustible love.

  7. I genuinely enjoy your website, but I’m having a problem: any time I load one of your post in Firefox, the center of the web page is screwed up — which is bizarre. May I send you a screenshot? In any event, keep up the superior work; I definitely like reading you. web design in new york

  8. This is a correct weblog for anyone who wishes to be familiar with this topic. You are aware of a lot its almost tricky to argue together with you (not too I really would want…HaHa). You definitely put a brand new spin over a topic thats been written about for many years. Great stuff, just great! branding agencies in san francisco

  9. They delivered a significant amount of quality code to support the development process satisfactorily. UX companies team was accessible and included capable talent that was accessible, facilitating an effective engagement. They were enthusiastic and communicative, which enabled successful collaboration.

  10. Thanks for making the honest attempt to speak about this. I believe very robust approximately it and want to read more. If it’s OK, as you gain more in depth wisdom, would you thoughts adding extra articles similar to this one with additional information? It might be extremely useful and useful for me and my friends. design agencies sf

  11. I think this is among the most vital info for me. And i am glad reading your article. But want to remark on some general things, The site style is great, the articles is really great : D. Good job, cheers ux agency san francisco

  12. This is tough. I’m not pointing fingers at you though, personally I think that its those that aren’t motivated to change. tablet mockup

  13. Animation professionals can be found in any field of business that utilizes video as a methods for articulation and along these lines there is incredible breadth for specialization and one can concentrate totally on one's advantage while picking the ideal work environment.anime merchandise

  14. The battle groupings include a couple of kicks and punches and a superhuman force is utilized which doesn't regularly exact a lot of shocking, physical harm on the adversary, rather the washout is left with a scratch or two all over with a stream of blood overflowing from their mouth. manganelo

  15. Wonderful defeat! We would like to newbie as you อ่านการ์ตูน modify your own web site, exactly how could we sign up for any weblog web site

  16. It has the such as you learn this imagination! manga

  17. My best particularly long online world look anime up has got at the end happen to be honored utilizing useful content that will go over utilizing my best guests.

  18. Learn in the following paragraphs the standard lessons of Manga and how to locate more comprehensive information concerning this fascinating kind of art. read manga online

  19. Today's Manga has been enjoyed by the Japanese culture for over half a century and its popularity in Japan covers all generations. 4anime

  20. Japanese Manga is taking western culture by storm.  read manga online

  21. Whatever you aspiring Manga artists out there that want to look at your art skills to a higher level. Well, you have luck, there is a solution.  9anime

  22. You know you want to look - don't be shy. Let's get you started... kissanime

  23. Hi,
    Such an amazing article. You would love to see my
    best animation services as well.

  24. It's a very useful website. and very knowledgeable I would like to introduce my website to you Under the Queen’s Umbrella i hope you like it.