Layouts

We have already seen ConstraintLayout, but there are more. Layouts are the building blocks that group together the other UI elements. Layouts can, and often do, contain other layouts themselves.

Let's look at some commonly used layouts in Android because knowing the different layouts and their pros and cons will make us more aware of what can be achieved, and therefore expand the horizons of what is possible.

We have already seen that once we have designed a layout, we can put it into action using the setContentView method in our Java code.

Let's build three designs with different layout types, and then put setContentView to work and switch between them.

Get Android Programming for Beginners - Second 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.