What is exact difference between gravity and layout_gravity [duplicate]

做~自己de王妃 提交于 2019-11-30 08:29:45
  1. Yes, your understanding is correct. Any layout_ attribute gives instructions to the parent view.
  2. 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 find gravity 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!