What is the difference between gravity and layout_gravity in Android?

前端 未结 20 1179
庸人自扰
庸人自扰 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 specify how to place the content of the object within the object itself. In another word, android:gravity is used to specify the gravity of the content of the view.

    android:layout_gravity is an attribution the child can supply to its parent, to specify the gravity the view within its parents.

    For more details you can visit

    http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html

提交回复
热议问题