帧布局布局方式(FrameLayout)
最简单的一个布局对象。它被定制为你屏幕上的一个空白备用区域,之后你可以在其中填充一个单一对象 — 比如,一张你要发 布的图片。所有的子元素将会固定在屏幕的左上角;你不能为FrameLayout中的一个子元素指定一个位置。
但是你可以通过子控件自身控制其位置。后一个子元素将会直接在前一个子元素之上进行覆盖填充,把它们部份或全部挡住
(除非后一个子元素是透明的).
Ps:游戏应用中比较常见
实践代码:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity"
android:background="@drawable/xiamu" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/next"
android:src="@drawable/next"
android:layout_gravity="right"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/play"
android:src="@drawable/play"
android:layout_gravity="center"/>
</FrameLayout>
截图: