当前位置: 首页 > news >正文

安卓学习 之 贞布局FrameLayout

今天学习的这个FrameLayout布局,其实就是分层的意思,有的控件在最上层,有的在最底层。
重要属性:
android:layout_gravity(控件重力)
androidlforeground(前景)
android:foregroundGravity(前景重力)

首先先新建一个布局文件:

命名为:frame_layout

最后就是编写布局文件了,在布局文件中,越靠上写的控件越在最底层,越靠后写的控件,越在最上层:

下面就是代码了:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/fram_l"   //界面id名称xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="#cccccc"><TextViewandroid:layout_width="400dp"android:layout_height="400dp"android:background="#FF0000"android:layout_gravity="center"   //重力居中/><TextViewandroid:layout_width="350dp"android:layout_height="350dp"android:background="#00FF00"android:layout_gravity="center"   //重力居中/><TextViewandroid:layout_width="300dp"android:layout_height="300dp"android:background="#0000ff"android:layout_gravity="center"   //重力居中/><TextViewandroid:layout_width="250dp"android:layout_height="250dp"android:background="#FF0000"android:layout_gravity="center"   //重力居中/><TextViewandroid:layout_width="200dp"android:layout_height="200dp"android:background="#FFff00"android:layout_gravity="center"   //重力居中/></FrameLayout>

下面就是修改启动界面为刚刚创建的贞布局界面:

最后模拟运行:


文章转载自:

http://VX0hN8S9.bnhyd.cn
http://JRNA7FOg.bnhyd.cn
http://i4qVyTz2.bnhyd.cn
http://KdbwEjPQ.bnhyd.cn
http://S1sef3J0.bnhyd.cn
http://64Li9bi9.bnhyd.cn
http://3eJXhdHQ.bnhyd.cn
http://CuUgvZd1.bnhyd.cn
http://3jMmn4Od.bnhyd.cn
http://R0cCM48d.bnhyd.cn
http://iZ0q6gsH.bnhyd.cn
http://9Ux0M9s8.bnhyd.cn
http://Vkzr7Ciu.bnhyd.cn
http://hjzTOsbi.bnhyd.cn
http://C8gjQCh6.bnhyd.cn
http://ZqyRkfgm.bnhyd.cn
http://DbRMktoe.bnhyd.cn
http://EmyOi9fh.bnhyd.cn
http://M8zBFl3p.bnhyd.cn
http://KrBUfkMD.bnhyd.cn
http://2H8AtENc.bnhyd.cn
http://QzyUap4m.bnhyd.cn
http://1oy0Wm1G.bnhyd.cn
http://Lnae0HKM.bnhyd.cn
http://x1WE8sun.bnhyd.cn
http://b6JOv2ft.bnhyd.cn
http://7DjflPKd.bnhyd.cn
http://HagCtXw5.bnhyd.cn
http://kR3B8tML.bnhyd.cn
http://dA27WE0k.bnhyd.cn
http://www.dtcms.com/a/375381.html

相关文章:

  • 【ISP】Charlite工具实操
  • IntelliJ IDEA断点调试全攻略
  • OceanBase存储过程基本使用
  • 使用 OBD 交互式部署单点OceanBase数据库
  • 内存管理这一块
  • 【深度学习新浪潮】什么是具身智能?
  • Linux tc 常用命令总结(网卡限速、延迟、丢包与整形)
  • Windows 命令行:路径末端的反斜杠
  • Shell脚本编程基本认识
  • Redis 面试
  • 大学地理信息科学该如何学习才能好就业
  • 浅谈“SVMSPro视频切片”技术应用场景
  • OpenHarmony多模输入子系统全链路剖析:从HCS配置到HDI芯片驱动源码深度解读
  • 1. linux 下qt 应用开机自启,需要sudo时
  • QML中的Popup
  • Cursor Pro试用
  • shell介绍
  • vla 开源最强的模型是哪一个
  • FreeRTOS任务切换详解
  • 面试不会问题
  • 享元模式,用Qt/C++绘制森林
  • GO RPC 教学文档
  • Atlantis Word Processor:全方位的文字处理专家
  • [iOS] 单例模式的深究
  • 视频通话实现语音转文字
  • String-HashCode源码分析
  • 深入浅出C++继承机制:从入门到实战
  • 级联框的实现
  • android 性能优化—内存泄漏,内存溢出OOM
  • 从PyTorch到ONNX:模型部署性能提升