6. Layout

Android applications are made to be seen, touched, and interacted with. To achieve this, you need to create a layout that your application will use to display the interface to the user. There are several ways to create your layout, and this chapter introduces you to the various layouts available and how they can be used in your application.

Layout Basics

You have two ways to control the layout you use in your application. As you learned in Chapter 5, “Views,” Views and ViewGroups can be created programmatically and edited. Some developers will be more comfortable creating and destroying layouts in this manner, but the application layout can also be created via XML.

When creating a new project in Android Studio, you will find a file ...

Get Android™ Development Patterns: Best Practices for Professional Developers 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.