FrameLayout布局中,不能控制子控件的位置,子控件默认放人FrameLayout的左上角。
XML布局例子如下:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/h1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name" />
<TextView
android:id="@+id/h3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<TextView
android:id="@+id/h2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search" />
</FrameLayout>