Android – Difference between gravity and layout_gravity

By -


Do you what’s the exact difference between gravity and layout_gravity attributes?

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.

Here is the best example that i came across: How to Position Views Properly in.

Here is my question on stackoverflow for the same: Android – gravity and layout_gravity

Paresh Mayani

Lazy android developer, exploring the horizon of android development since 7 years, currently working as a Technical Lead - Android at Simform Solutions, India. Former Application Architect at KarConnect. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

Loading Facebook Comments ...
Loading Disqus Comments ...