What is the difference between gravity and layout_gravity in Android?

前端 未结 20 1553
庸人自扰
庸人自扰 2020-11-21 11:41

I know we can set the following values to the android:gravity and android:layout_gravity properties:

    <
20条回答
  •  迷失自我
    2020-11-21 12:24

    android:gravity
    

    is used to adjust for content of the view relative to its specify position (allocated area). android:gravity="left" would not do anything if layout_width is equal to the "wrap_content"

    android:layout_gravity 
    

    is used for view itself relative to the parent or layout file.

提交回复
热议问题