Chapter 6

Enhancing Your Layout with Widgets, Styles, and Themes

In This Chapter

  • Understanding built-in views (or widgets)
  • Selecting the right widget for the job
  • Creating your own, custom widget
  • Applying styles and themes

Designing the overall layout is only one piece of the puzzle involved in creating a user interface for your app. In this chapter, we describe the basic views used for individual data entry or selection. You can modify these views for your own app's style or allow users to apply their own themes. If this level of control isn't sufficient for you, the entire suite of drawing tools is available to create your own, custom controls.

Beholding the Power of the Framework: Built-In Views

The Android SDK provides a rich and fairly comprehensive set of components for you to use in your apps. Figure 6-1 shows the class hierarchy of the built-in widgets. (The children of ViewGroup have been omitted, for brevity.) All are available in the Android.widget package. Most of them have been in the framework beginning with version 1. KeyboardView and GLSurfaceView were added in version 3, and QuickContactBadge was added in version 5. The RSSurfaceView class is the new addition to version 11 (Android 3.0). RSSurfaceView is not a true widget but, rather, a raw surface on which to draw and, in this case, an OpenGL ES surface for Renderscript. RSSurfaceView replaces GLSurfaceView.

Figure 6-1: The class hierarchy of View.

New widgets can be created by deriving and extending any of ...

Get Android™ 3 SDK Programming For Dummies® 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.