BBS checked, found both to,
Gravity is decided to control how content is inside control positioning,
Layout_gravity is decided to control how in his father's layout position,
The appended drawings


CodePudding user response:
Gravity, in themselves, the contents of the control center will based on current control matrix, according toLayout_gravity the control relative to the parent layout position, of course the parent layout if set in the middle and you to the location of the layout is preferred,
& lt; ? The XML version="1.0" encoding="utf-8"?>XMLNS: android="http://schemas.android.com/apk/res/android" android: layout_width="match_parent
"Android: layout_height="match_parent"
Android: gravity="center" & gt;Android: layout_width="match_parent"
Android: layout_height="@ dimen/dp_12"
Android: text="DDDDD"
Android: gravity="center"
Android: layout_gravity="bottom"/& gt;

, not all the layout of the effective, RelativeLayout, FrameLayout, are based on the relative position, or the frame of the press, specific issues