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.

The Classic Container Classes

Containers — sometimes referred to as layout managers — organize widgets on the screen. Containers position and size widgets based upon rules that you supply along with key device characteristics, such as available screen size.

Three containers have dominated Android app development since Android’s introduction in late 2007: LinearLayout, RelativeLayout, and TableLayout. This chapter focuses on those. Later chapters will explore other container classes, such as 2016’s ConstraintLayout.

Introducing the Sampler App

The Containers/Sampler sample project has a bunch of layout resources that this chapter will use to illustrate how these containers work.

If you were to run this sample app, you would see a series of tabs, with one layout displayed per tab:

Sampler App, As Initially Launched
Figure 105: Sampler App, As Initially Launched

We are not going to get into the Java code associated with this sample app in this chapter. That code relies on other topics, like fragments and the ViewPager widget, that we have not gotten to yet. We will come back to this sample app and see how the tabs were implemented then. For now, the focus is on the layout files showing specific techniques for using these classic containers.

RTL and Your Layouts

The preview of this section is en route to Mars.

LinearLayout and the Box Model

The preview of this section was abducted by space aliens.

All Things Are Relative

The preview of this section was lost due to a rupture in the space-time continuum.

Tabula Rasa

The preview of this section was traded for a bag of magic beans.

Hey, What About ConstraintLayout?

The preview of this section took that left turn at Albuquerque.

Turning Back to RTL

The preview of this section apparently resembled a Pokémon.