android中的BorderLayout?

Joe*_*oel 3 android border-layout

有没有实现的方式工作在Android的可重复使用的边界布局?一个行为就像swing的BorderLayout:最大化中间并将其余部分缩小到最小尺寸?

And*_*ndy 6

试试这个,你会得到与Swings BorderLayout相同的行为(结果显示在图片中):

BorderLayout演示

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

<TextView
    android:id="@+id/north"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:background="@android:color/holo_orange_light"
    android:gravity="center_horizontal"
    android:text="North"
    android:textAppearance="@android:style/TextAppearance.Large" />

<TextView
    android:id="@+id/south"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@android:color/holo_blue_light"
    android:gravity="center_horizontal"
    android:text="South"
    android:textAppearance="@android:style/TextAppearance.Large" />

<TextView
    android:id="@+id/west"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_above="@id/south"
    android:layout_alignParentLeft="true"
    android:layout_below="@id/north"
    android:background="@android:color/holo_red_light"
    android:gravity="center_vertical"
    android:text="West"
    android:textAppearance="@android:style/TextAppearance.Large" />

<TextView
    android:id="@+id/east"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_above="@id/south"
    android:layout_alignParentRight="true"
    android:layout_below="@id/north"
    android:background="@android:color/holo_purple"
    android:gravity="center_vertical"
    android:text="East"
    android:textAppearance="@android:style/TextAppearance.Large" />

<TextView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@id/south"
    android:layout_below="@id/north"
    android:layout_toLeftOf="@id/east"
    android:layout_toRightOf="@id/west"
    android:background="@android:color/holo_green_light"
    android:gravity="center"
    android:text="Center"
    android:textAppearance="@android:style/TextAppearance.Large" />
Run Code Online (Sandbox Code Playgroud)