Chapter 2. Showing Views and Handling Fragments

In this chapter, we will cover the following recipes:

  • Using custom views with layouts
  • Creating and using fragments
  • Preserving view and fragment state
  • Navigating between fragments
  • Fragments and the action bar
  • Animating fragment navigation
  • Animating view and object properties
  • Animating views on the UI
  • Adding a navigation drawer with fragments
  • Applying local styles and global themes

Introduction

All apps have one thing in common: they all have some sort of user interface. Whether it is a rich set of controls or just a simple notification that something happened, all apps present the user with a means to consume information or provide data.

Users desire an interface that is easy to use and beautiful to look at. Often, the simplest way to improve the interface is to add a transition between states. This provides a way to move the user from one state to another, but without a sharp and sudden change.

In order to move the user between states or allow the user to initiate such a movement, the app needs to provide a set of actions or navigation points. As navigation through the app is often not the primary function of the app, these controls should be placed within easy reach but should not obstruct the real functionality.

Animations and transitions do not change the functionality of an app, but they do make the user experience more enjoyable. Navigation is often the most jarring change, and transitions provide a smoother experience.

Not only do transitions improve navigation, but designing the user interface for navigation also makes the experience better. Taking advantage of new and popular navigation concepts, the app can become a pleasure to use.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset