<RelativeLayout> 會把此佈局內的元件利用各元件的id來做相對位置的佈局,下為六種排列情況之示意圖。

layout05.jpg   

FrameLayout常用屬性表

layout10.jpg  

 小試身手範例一:

此範例會使用到三個<TextView元件>主要為below測試。

main.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    >

    <TextView

    android:text="元件一_目標元件"

    android:id="@+id/textView01"

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:textSize="27sp"

    />

    <TextView

    android:text="元件二_below目標元件"

    android:id="@+id/textView02"

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:textSize="27sp"

    android:layout_below="@id/textView01"

    />

    <TextView 

    android:text="元件三_below元件二"

    android:id="@+id/textView03"

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:textSize="27sp"

    android:layout_below="@id/textView02"

    />

</RelativeLayout>

layout08.jpg  



 

arrow
arrow
    文章標籤
    android layout RelativeLayout
    全站熱搜

    S 發表在 痞客邦 留言(0) 人氣()