What is exact difference between gravity and layout_gravity [duplicate]
- Yes, your understanding is correct. Any
layout_
attribute gives instructions to the parent view. - Generally, if a view is taking up the full width/height of its' parent, then you won't need to specify
layout_gravity
, you'll probably findgravity
more useful. If your view does not take up an entire dimension of its' parent, you might want to align it depending on your desired look.
Their name should help you :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.
For more info visit this site
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.