Checking out the gravity attribute

View Gravity:

  • gravity (direction of the content inside the view): This accepts the following--top, left, right, start, end, center, center_horizontal, center_vertical, and many other
  • layout_gravity (direction of the content inside the view parent): This accepts the following--top, left, right, left, start, end, center, center_horizontal, center_vertical, and many others

It's possible to combine values for gravity as follows:

    android:gravity="top|center_horizontal" 

Get Mastering Android Development with Kotlin 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.