Android开发之布局的学习

FrameLayout-帧布局

实现效果:

代码:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent" >
 5     
 6     <TextView android:layout_width="300dp"
 7         android:layout_height="300dp"
 8         android:layout_gravity="center"
 9         android:background="#ff0000"/>
10     
11     <TextView android:layout_width="250dp"
12         android:layout_height="250dp"
13         android:layout_gravity="center"
14         android:background="#00ff00"/>
15     
16     <TextView android:layout_width="200dp"
17         android:layout_height="200dp"
18         android:layout_gravity="center"
19         android:background="#0000ff"/>
20     
21     <TextView android:layout_width="150dp"
22         android:layout_height="150dp"
23         android:layout_gravity="center"
24         android:background="#ffff00"/>
25     
26     <TextView android:layout_width="100dp"
27         android:layout_height="100dp"
28         android:layout_gravity="center"
29         android:background="#ffc0cb"/>
30     
31     <TextView android:layout_width="50dp"
32         android:layout_height="50dp"
33         android:layout_gravity="center"
34         android:background="#f8f8ff"/>
35 
36 </FrameLayout>
原文地址:https://www.cnblogs.com/liyiran/p/5029659.html