FrameLayout(框架布局)

框架布局是最简单的布局形式。所有添加到这个布局中的视图都以层叠的方式显示。第一个添加的控件被放在最底层,最后一个添加到框架布局中的视图显示在最顶层,上一层的控件会覆盖下一层的控件。这种显示方式有些类似于堆栈。

一般很少使用,所以只是作为一个知识点列出来。借鉴于前人的样例

效果:

代码;

 1 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     android:layout_width="fill_parent" 
 3     android:layout_height="fill_parent">
 4     <TextView android:id="@+id/textview1" 
 5         android:layout_width="300dp"
 6         android:layout_height="300dp" 
 7         android:layout_gravity="center" 
 8         android:background="#FF33ffff" />
 9     <TextView android:id="@+id/textview2" 
10         android:layout_width="240dp"
11         android:layout_height="240dp" 
12         android:layout_gravity="center" 
13         android:background="#FF33ccff" />
14     <TextView android:id="@+id/textview3" 
15         android:layout_width="180dp"
16         android:layout_height="180dp" 
17         android:layout_gravity="center" 
18         android:background="#FF3399ff" />
19     <TextView android:id="@+id/textview4" 
20         android:layout_width="120dp"
21         android:layout_height="120dp" 
22         android:layout_gravity="center" 
23         android:background="#FF3366ff" />
24     <TextView android:id="@+id/textview5" 
25         android:layout_width="60dp"
26         android:layout_height="60dp" 
27         android:layout_gravity="center" 
28         android:background="#FF3300ff" />
29 </FrameLayout>

 更详细内容介绍:【Android UI设计与开发】第07期:底部菜单栏(二)Fragment的详细介绍和使用方法

posted @ 2013-01-17 17:21  欢醉  阅读(55594)  评论(6编辑  收藏  举报