Let's say you want to have a TextView and a Button in a Layout with horizontal orientation. Can you have the TextView aligned to the left and the Button - to the right?
---------------------
TextView Button
---------------------
Let's say you want to have a TextView and a Button in a Layout with horizontal orientation. Can you have the TextView aligned to the left and the Button - to the right?
---------------------
TextView Button
---------------------
Use a relative layout and position the second view to right.
android:layout_toRightOf="@id/firstView"
android:layout_alignTop="@id/firstView"
1) Use a RelativeLayout and android:layout_alignParentLeft="true" on one and android:layout_alignParentRight="true" on the other.
2) Use a LinearLayout with android:orientation="horizontal", and set android:gravity="left" & android:layout_weight="1" on one and android:gravity="right" & android:layout_weight="1" on the other (yes, the weight is required!)
Note, using layout_toRightOf will give left/right relative positioning but it won't force them to the edge of the screen/parent container.