DIFFERENCE BETWEEN GRAVITY AND LAYOUT_GRAVITY ON ANDROID

Chintoo Semi

Total Post:135

Points:947
Posted by  Chintoo Semi
 872  View(s)
Ratings:
Rate this:
I know we can set the following value to the android:gravity and  android:layout_gravity.

center
center_vertical
center_horizontal, etc.
But I am confused regarding both of these.

What is the difference between the usage of android:gravity and android:layout_gravity?
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: Difference between Gravity and layout_gravity on Android

    Their names should help you:


    android:gravity sets the gravity of the content of the View its used on.

    android:layout_gravity sets the gravity of the View or Layout in its parent.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!