Android supplies a toolbox of standard Views to help you create simple interfaces. By using these controls (and modifying or extending them as necessary), you can simplify your development and provide consistency between applications.
The following list highlights some of the more familiar toolbox controls:
> TextView A standard read-only text label. It supports multiline display, string formatting, and automatic word wrapping.
> EditText An editable text entry box. It accepts multiline entry, word-wrapping, and hint text.
> ListView A View Group that creates and manages a vertical list of Views, displaying them as rows within the list. The simplest List View displays the toString value of each object in an array, using a Text View for each item.
> Spinner A composite control that displays a Text View and an associated List View that lets you select an item from a list to display in the textbox. It's made from a Text View displaying the current selection, combined with a button that displays a selection dialog when pressed.
> Button A standard push-button.
> CheckBox A two-state button represented by a checked or unchecked box.
> RadioButton A two-state grouped button. A group of these presents the user with a number of binary options of which only one can be enabled at a time.
> ViewFlipper A View Group that lets you define a collection of Views as a horizontal row in which only one View is visible at a time, and in which transitions between visible views are animated.
> QuickContactBadge Displays a badge showing the image icon assigned to a contact you specify using a phone number, name, e-mail address, or URI. Clicking the image will display the quick contact bar, which provides shortcuts for contacting the selected contact — including calling, sending an SMS, e-mail, and IM.
This is only a selection of the widgets available. Android also supports several more advanced View implementations, including date-time pickers, auto-complete input boxes, maps, galleries, and tab sheets. For a more comprehensive list of the available widgets, head to http://developer.android.com/guide/tutorials/views/index.html
It's only a matter of time before you, as an innovative developer, encounter a situation in which none of the built-in controls meets your needs. Later in this chapter you'll learn how to extend and combine the existing controls and how to design and create entirely new widgets from scratch.
Was this article helpful?
Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.