Android 9 Development Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

How it works...

This is a very straightforward exercise but it demonstrates several of the RelativeLayout options: layout_centerVertical, layout_centerHorizontal, layout_below, layout_alignParentBottom, and so on.

The most commonly used RelativeLayout layout attributes include the following:

  • layout_below: This View should be below the View specified.
  • layout_above: This View should be above the View specified.
  • layout_alignParentTop: Align this View to the top edge of the parent.
  • layout_alignParentBottom: Align this View to the bottom edge of the parent.
  • layout_alignParentLeft: Align this View to the left edge of the parent.
  • layout_alignParentRight: Align this View to the right edge of the parent.
  • layout_centerVertical: Center this View vertically within the parent.
  • layout_centerHorizontal: Center this View horizontally within the parent.
  • layout_center: Center this View both horizontally and vertically within the parent.
For the complete list of RelativeLayout parameters, visit  http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html.