Android animation basics

SDK Version: 

In android there are 4 basic types of animations:

  • AlphaAnimation
  • RotateAnimation
  • ScaleAnimation
  • TranslateAnimation

This animations can be highly customized and combined, for example we can set the speed, delay, acceleration, duration of animations, then group them together in an AnimationSet.

Animations can be applyed as Layout animations to ViewGroups, to be triggered when the ViewGroup is created/displayed or applied to any view and be triggered by us any time.

The animations can be definex in XMl or by code. Defining in xml is mutch more clear, but you can not set animation parameters dinamically.

The animation XML files should be created in the res/anim folder and can be accessed using the R class, like R.anim.animation_name.

An animation defined in hyperspace_jump.xml can look like this:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <set xmlns:android="">

Syndicate content