Using Android Layouts - dummies

By Michael Burton

When you create a user interface for an Android app, you sometimes have to lay out components relative to each other, or in a table, or in a list or grid. Thankfully, the engineering geniuses at Google who created Android thought of all this and provided the necessary tools to create those types of layouts. The table briefly introduces the common types of layouts available in Android.

Android SDK Layouts
Layout What It Does
FrameLayout Designed to block out an area on the screen to display a single
item. You can add multiple children to a FrameLayout, but all
children are pegged to the upper left area of the screen by
default. Children are drawn in a stack, with the most recently
added child at the top of the stack.
This layout is commonly used as a way to lay out views on top of
each other, or to lay them out relative to their parent.
LinearLayout Arranges its children in a single row or column.
RelativeLayout Lets the positions of the children be described in relation to
each other or to the parent.
GridLayout Arranges its children into a grid.

Other, different types of layout tools exist, such as a TabHost for creating tabs and DrawerLayout for side “drawers” that hide and display views. Programmers tend to use these layout tools in special-case scenarios. The items in the table outline the most commonly used layouts.

For now, this example uses the simplest layout, the FrameLayout.