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 @   欢醉  阅读(55657)  评论(6编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
点击右上角即可分享
微信分享提示