Android中的FrameLayout帧布局
Android 布局
2023-09-14 09:07:56 时间
帧布局由FrameLayout所代表,FrameLayout直接继承了ViewGoup组件。
帧布局容器为每一个增加当中的组件创建一个空白的区域(称为一个帧),每一个子组件占领一帧,这些帧都会依据gravity属性运行自己主动对齐。
代码:
<?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" android:orientation="vertical" > <!-- 依次定义6个TextView。先定义的TextView位于底层 后定义的TextView位于上层 --> <TextView android:id="@+id/view01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:width="320px" android:height="320px" android:background="#f00" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:width="280px" android:height="280px" android:background="#0f0" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:width="240px" android:height="240px" android:background="#00f" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:width="200px" android:height="200px" android:background="#ff0" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:width="160px" android:height="160px" android:background="#f0f" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:width="120px" android:height="120px" android:background="#0ff" /> </FrameLayout>
效果:
相关文章
- android studio不能输入中文_Android模拟器
- android 置灰不可点击,Android Studio 运行按钮灰色的完美解决方法
- android onresume函数,Android界面跳转时候onDestroy和onResume的调用顺序
- Android系统五大布局详解Layout
- android 空间分享到朋友圈,Android开发之微信分享到好友,朋友圈
- android bindservice方法,Android bindservice方法返回false
- android开发笔记之 Android代码混淆打包
- Android抽象布局——include、merge 、ViewStub[通俗易懂]
- 测试android sdk是否安装成功,配置Android SDK
- android sdk manager安装,Android SDK Manager安装过程
- Android 开发环境详细概述
- Android触摸事件_android设置按钮点击事件
- Android时间_时间戳是什么格式
- PermissionX 1.7发布,全面支持Android 13运行时权限
- eclipse如何开发安卓_Android开发教程
- Android修改字体_android设置字体样式
- 【Jetpack】DataBinding 架构组件 ( 数据绑定技术简介 | Android 中的 DataBinding 数据绑定 | 启动数据绑定 | 定义数据类 | 布局文件转换 )
- 【Android 性能优化】布局渲染优化 ( GPU 过度绘制优化总结 | CPU 渲染过程 | Layout Inspector 工具 | View Tree 分析 | 布局组件层级分析 )
- 【Android 异步操作】AsyncTask 异步任务 ( 参数简介 | 方法简介 | 使用方法 | AsyncTask 源码分析 )
- 【Android NDK 开发】Kotlin 语言中使用 NDK ( 创建支持 Kotlin 的 NDK 项目 | Kotlin 语言中使用 NDK 要点 | 代码示例 )
- 【Android 逆向】Android 权限 ( Android 逆向中使用的 android.permission 权限 | Android 系统中的 Linux 用户权限 )
- 【Android 逆向】修改 Android 系统文件 ( ro 只读文件系统 | 系统文件格式 | rootfs | tmpfs | devpts | sysfs |proc | /system )
- 【Android RenderScript】RenderScript 简介 ③ ( RenderScript 发布和运行 | RenderScript 脚本 )
- Android动态布局入门及NinePatchChunk解密
- [android] 天气app布局练习详解手机开发
- Android中的ProgressBar的android:indeterminate详解手机开发
- Android Opengles mediaCodec 预览录制视频 添加水印详解手机开发
- Your Phone更新:Win10可同时串流使用多个Android应用
- 超过20%用户仍在使用Android第三方ROM
- Android中的android:layout_weight使用详解
- android开发教程之switch控件使用示例
- Android实现加载广告图片和倒计时的开屏布局