Android – Difference between gravity and layout_gravity

By -

Hi,

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

CEO & Co-Founder at SolGuruz® | Organiser @ GDG Ahmedabad | Top 0.1% over StackOverflow | 15+ years experienced Tech Consultant | Helping startups with Custom Software Development

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