Search code examples
androidandroid-layoutandroid-relativelayout

Relative Layout: difference between layout_alignBottom and layout_above


I have read document about those two attributes of relative layout, and try some examples, but still not recognize what difference between them. I have tried some test, but often i have same result, and sometimes, different, but i cannot explain.

Here is description on Android Document :

android:layout_above
Positions the bottom edge of this view above the given anchor view ID. Accommodates bottom margin of this view and top margin of anchor view.

android:layout_alignBottom
Makes the bottom edge of this view match the bottom edge of the given anchor view ID. Accommodates bottom margin.

Thanks :)


Solution

  • This image explains everything :)

    enter image description here

    above: the bottom edge of view is placed on top edge of view A

    alignBottom: the bottom edge of a view is on the same line View B is.