The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
There is a decent chance that you have already done work with widget-based UI frameworks. In that case, much of this chapter will be review, though checking out the section on the absolute positioning anti-pattern should certainly be worthwhile.
There is a chance, though, that your UI background has come from places where you have not been using a traditional widget framework, where either you have been doing all of the drawing yourself (e.g., game frameworks) or where the UI is defined more in the form of a document (e.g., classic Web development). This chapter is aimed at you, to give you some idea of what we are talking about when discussing the notion of widgets and containers.
Wikipedia has a nice definition of a widget:
In computer programming, a widget (or control) is an element of a graphical user interface (GUI) that displays an information arrangement changeable by the user, such as a window or a text box. The defining characteristic of a widget is to provide a single interaction point for the direct manipulation of a given kind of data. In other words, widgets are basic visual building blocks which, combined in an application, hold all the data processed by the application and the available interactions on this data.
(quote from the 7 March 2014 version of the page)
Take, for example, this Android screen:
Figure 65: A Sample Android Screen
Here, we see:
Everything listed above is a widget. The user interface for most Android screens (“activities”) is made up of one or more widgets.
This does not mean that you cannot do your own drawing. In fact, all the existing widgets are implemented via low-level drawing routines, which you can use for everything from your own custom widgets to games.
This also does not mean that you cannot use Web technologies. In fact, we will see later in this book a widget designed to allow you to embed Web content into an Android activity.
However, for most non-game applications, your Android user interface will be made up of several widgets.
The preview of this section was stepped on by Godzilla.
The preview of this section will not appear here for a while, due to a time machine mishap.
The preview of this section is sleeping in.
The preview of this section was fed to a gremlin, after midnight.