Home > DeveloperSection > Forums > Difference between Gravity and layout_gravity on Android
Chintoo Semi

Total Post:135

Posted on    May-22-2015 12:10 AM

 Android Android 

 1 Reply(s)
 567  View(s)
Rate this:
I know we can set the following value to the android:gravity and  android:layout_gravity.

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?

Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    May-22-2015 8:05 AM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick