Getting Started with Android. RelativeLayout Relative Layout 1

RelativeLayout relative layout

The so-called relative layout, that is, the placement of the second control, is the relative position of the first control


	<TextView
	    android:id="@+id/textView1"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:background="#FF0000"
	    android:text="first"
	    />
	<TextView
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:background="#00ff00"
	    android:text="Second"
	    android:layout_toRightOf="@id/textView1"//The control is placed on the right side of the control whose id is textView1
	    />

@id, to refer to an already created control id
@+id, to create a new control id


android:layout_toLeftOf is placed on the left
android:layout_below placed below
android:layout_above is placed on top


android:layout_alignRight="@id/textView1" is aligned to the right


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327028172&siteId=291194637