標籤:ntop 技術 textview enter 中間 back ast XML content
XML代碼:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- 定義該組件位於父容器中間 --><TextView android:id="@+id/view01" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/a" android:layout_centerInParent="true" /><!-- 定義該組件位於父容器上方 --><TextView android:id="@+id/view02" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/a" android:layout_above="@id/view01" android:layout_alignLeft="@id/view01" /><!-- 定義該組件位於view01組件的下方 --><TextView android:id="@+id/view03" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/a" android:layout_below="@id/view01" android:layout_alignLeft="@id/view01" /><!-- 定義該組件位於view01組件的左邊 --><TextView android:id="@+id/view04" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/a" android:layout_toLeftOf="@id/view01" android:layout_alignTop="@id/view01" /><!-- 該組件位於view01組件的右邊 --><TextView android:id="@+id/view05" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/a" android:layout_toRightOf="@id/view01" android:layout_alignTop="@id/view01" /></RelativeLayout>
效果:
Android利用reative_layout產生梅花介面