Setting animations

We consider our layout to be nice. It is pretty. But can it be more entertaining? Sure it can! If we make our layout more interactive we will achieve a better user experience and attract users to use it. We will achieve that by adding some animations. Animations can be defined through the code or by animating view properties. We will improve each of the screens by adding simple and effective opening animations.

Animations defined as resources are located in the anim resources directory. We will need a few animation resources there--fade_in, fade_out, bottom_to_top, top_to_bottom, hide_to_top, hide_to_bottom. Create them and define them according to these examples:

  • fade_in:
 <?xml version="1.0" encoding="utf-8"?> <alpha ...

Get Mastering Android Development with Kotlin now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.