Creating custom animations

Android animations are in fact resource files, much like an icon or a layout. The animations that apply to layouts and widgets are XML files that define the various transformations and are placed in the res/anim directory. Android provides a small selection of simple animations that you can use in your application, without needing to build your own:

  • android.R.anim.fade_in - @android:anim/fade_in
  • android.R.anim.fade_out - @android:anim/fade_out
  • android.R.anim.slide_in_left - @android:anim/slide_in_left
  • android.R.anim.slide_out_right - @android:anim/slide_out_right

These four animations cover two different types of transition: fading out and in, or sliding the widgets from left to right. Nothing stops you from mixing ...

Get Hands-On Android UI Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.