What is the difference between android:layout_alignRight="@id/someId"
and android:layout_toRightOf="@id/someId"
?
android:layout_above : Places the element above the specified element. android:layout_below : Places the element below the specified element. android:layout_toLeftOf : Places the element to the left of the specified element. android:layout_toRightOf : Places the element to the right of the specified element.
RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left or center).
Android RelativeLayout enables you to specify how child views are positioned relative to each other. The position of each view can be specified as relative to sibling elements or relative to the parent.
This picture will explain the difference :
layout_alignRight
aligns the right edges of the two views.
layout_toRightOf
aligns the left edge of this view with the right edge of the other someId
view.
Documentation: http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With