I know we can set the following values to the android:gravity and android:layout_gravity properties:
centercenter_verticalcenter_horizontal, etc.
But I am confused regarding both of these.
What is the difference between the usage of android:gravity and android:layout_gravity?
Answer
Their names should help you:
android:gravitysets the gravity of the contents (i.e. its subviews) of theViewit's used on.android:layout_gravitysets the gravity of theVieworLayoutrelative to its parent.
And an example is here.
No comments:
Post a Comment