Gravity This English word is the meaning of the center of gravity, here means the docking position.
The difference between android:layout_gravity and android:gravity
As you can see from the name, Android:gravity is the element itself, where the text of the element itself is displayed in a different property setting, but not set by default on the left.
Android:layout_gravity is relative to its parent element, stating where the element appears in the parent element.
For example, button:android:layout_gravity represents the position of the button on the interface. The android:gravity represents the position of the word on the button on the button.
Optional values
The optional values for these two properties are: Top, bottom, left, right, center_vertical, fill_vertical, Center_horizontal, fill_horizontal, center, fill, Clip_vertical.
And these properties are available in multiple selections, with the "|" Separate.
The default value for this is: Gravity.left
The difference between android:layout_gravity and android:gravity