Chapter 4

Understanding Fragments

What's in this Chapter?

Using Views and layouts

Optimizing layouts

Creating resolution-independent user interfaces

Extending, grouping, creating, and using Views

Using Adapters to bind data to Views

To quote Stephen Fry on the role of style as part of substance in the design of digital devices:

As if a device can function if it has no style. As if a device can be called stylish that does not function superbly…. Yes, beauty matters. Boy, does it matter. It is not surface, it is not an extra, it is the thing itself.

Stephen Fry, The Guardian (October 27, 2007)

Although Fry was describing the style of the devices themselves, the same can be said of the applications that run on them. Bigger, brighter, and higher resolution displays with multitouch support have made applications increasingly visual. The introduction of devices optimized for a more immersive experience—including tablets and televisions—into the Android ecosystem has only served to increase the importance of an application's visual design.

In this chapter you'll discover the Android components used to create UIs. You'll learn how to use layouts, Fragments, and Views to create functional and intuitive UIs for your Activities.

The individual elements of an Android UI are arranged on screen by means of a variety of Layout Managers derived from the ViewGroup class. This chapter introduces several native layout classes and demonstrates how to use them, how to create your own, and how to ensure ...

Get Professional Android 4 Application Development, 3rd Edition 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.