Chapter 11. Working with the User Interface

The user interface (UI) of any mobile application is important, and Android’s widespread use requires that your software run well on a variety of different target devices. Generally, the wider range of devices you can support, the larger your potential customer base.

In almost all mobile applications, the elegance and usability of the user interface are more important than anything else. Your app has to look good to succeed in today’s market. However, creating an attractive UI is made more difficult by the vast profusion of screen sizes and resolutions in Android. You can’t finesse the problem by restricting your app to work on only one or a small range of devices; at least, you can’t do that without giving up a very large number of potential customers.

This is where the Android framework comes to the rescue. From the beginning, Android was designed to support various devices and has thus offered simple ways for the developer to support them. The developer tools are also designed to make supporting multiple devices easier.

Android Layout Basic Concepts

In order to leverage all the features of the UI, it is important to understand the fundamental concepts of the framework.

Defining Layouts Using XML

Android layouts are conventionally created using XML syntax to define the user interface (UI) of an app. These XML files contain descriptions of various interface widgets, which could be TextViews, Buttons, or ImageViews (don’t confuse these with ...

Get Android Developer Tools Essentials 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.