android:layout_gravity is the Outside gravity of the View. That means, to specify the direction in which the View should touch it’s parent’s border.
android:gravity is the Inside gravity of that View. This means, in which direction it’s contents should align.
android:layout_gravity = float in CSS
android:gravity = text-align in CSS
Easy trick to remember: Take “layout-gravity” as “Lay-outside-gravity”