==================[ Layout practicalities ]================== See cheatsheets in cheatsheets/ for Views and Layouts at a glance. LinearLayouts can be nested to create quite complex geometries of views. Just like with HTML, you can create rows and columns as you need, placing elements either side-by-side with a horizontal LinearLayout or under each other with a vertical one, and nest these groups to align them. You can control alignment of a layout element's contents (internals) by setting android:gravity attribute on the layout. You can control the alignment of individual children with respect to the parent's bounds by setting android:layout_gravity on them. Combining these attributes with "match_parent" or "wrap_content" for the width and height, you can do a lot, even though not always easily. One good rule of thumb to remember about layout_gravity attributes is that in LinearLayouts they work in the direction orthogonal to the layout's orientation. That is, in a vertical layout it's easy to shift pieces left and right or center them horizontally with layout_gravity; in a horizontal layout, it's easy to shift them vertically up or down. For example, getting a text label aligned to the right rather than to the left (the default) in a vertical LinearLayout can be done so: ... BTW, if you choose "match_parent" for the label, gravity will have no effect, because there's nowhere for the full-width box to shift inside the parent (whose width it's matching). I tried this today in class, to no effect (predictably). Note that a horizontal LinearLayout packs its elements one after another in a row (and a vertical one in a column). If you want some space breaks between them, you'll need to use margins, e.g., android:layout_marginRight="16dp" for a 16-point space between this element and the next one in row. Then you can shift the row glued together in this fashion to the center, left, or right using android:gravity on their parent. This way you can center a group of several buttons with some gaps between them. The problem with this approach is that nesting layouts makes for slower drawing. So using one Layout object to manage the whole screen is encouraged by Android. So there's the TableLayout, which gives you something very similar to HTML tables, and eliminates the need for nesting LinearLayouts to get a two-dimensional grid: https://developer.android.com/guide/topics/ui/layout/grid.html There's also RelativeLayout, which, instead of using rows and columns, lets you specify the relative positions of elements w.r.t. each other. Where a vertical LinearLayout would give you a "ladder" of buttons one under the other (see http://sandipchitale.blogspot.co.uk/2010/05/linearlayout-gravity-and-layoutgravity.html), a RelativeLayout can simply place them in the same row, and stick one to the left margin and one to the right: