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

安卓基本布局(下)

TableLayout

常用属性描述
collapseColumns设置需要被隐藏的列的列号。
shrinkColumns设置允许被伸缩的列的列号。
stretchColumns设置允许被拉伸的列的列号。
<TableLayout  xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/TableLayout"android:layout_width="fill_parent"android:layout_height="wrap_content"android:collapseColumns="0,2"android:shrinkColumns="3"android:stretchColumns="1"><TableRow><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="one" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="two" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="three" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="four" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="five" /></TableRow>
</TableLayout>

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

FrameLayout帧布局

  这个布局直接在屏幕上开辟出一块空白的区域,当我们往里面添加控件的时候,会默认把他们放到这块区域的左上角。帧布局的大小由控件中最大的子控件决定,如果控件的大小一样大的话,那么同一时刻就只能看到最上面的那个组件,后续添加的控件会覆盖前一个。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/FrameLayout1"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".FrameLayoutActivity"><TextViewandroid:layout_width="200dp"android:layout_height="200dp"android:background="#FF6143" /><TextViewandroid:layout_width="150dp"android:layout_height="150dp"android:background="#7BFE00" /><TextViewandroid:layout_width="100dp"android:layout_height="100dp"android:background="#FFFF00" /></FrameLayout>

在这里插入图片描述

GridLayout

  与表格布局类似,但是比表格布局灵活。

常用属性描述
orientation设置排列方式。vertical:竖直(默认);horizontal:水平。
layout_gravity设置对齐方式。
rowCount设置行数。
columnCount设置列数。
layout_row设置第几行。
layout_column设置第几列。
layout_rowSpan设置横跨几行。
layout_columnSpan设置横跨列数。
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/GridLayout1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:columnCount="5"android:orientation="horizontal"android:rowCount="5" ><Buttonandroid:layout_gravity="fill"android:text="1"android:layout_columnSpan="3"/><Buttonandroid:layout_gravity="fill"android:text="2"android:layout_column="1"android:layout_rowSpan="3"/><Button android:text="3" /><Buttonandroid:text="4"android:layout_row="2"/><Button android:text="5" /><Button android:text="6" /><Button android:text="7" /><Button android:text="8" /><Button android:text="9" /></GridLayout>

在这里插入图片描述

http://www.lryc.cn/news/418350.html

相关文章:

  • Python中使用正则表达式
  • 三大口诀不一样的代码,小小的制表符和换行符玩的溜呀
  • [qt] 线程等待与唤醒
  • Springboot 实现 Modbus Rtu 协议接入物联网设备
  • 鸿蒙笔记--装饰器
  • 不同环境下RabbitMQ的安装-3 操作RabbitMQ
  • postgregSQL配置vector插件
  • PUMA论文阅读
  • 算法学习day31(动态规划)
  • 嵌入式学Day25---Linux软件编程---线程间通信
  • 【实现100个unity特效之17】在unity中使用shader和ShaderGraph分别实现模糊特定层,高斯模糊效果
  • Unity补完计划 之 SpriteEditer Multiple
  • C++ IOStream
  • 2024/8/8训练
  • 项目的小结
  • 【目标检测实验系列】YOLOv5高效涨点:基于NAMAttention规范化注意力模块,调整权重因子关注有效特征(文内附源码)
  • LSPatch制作内置模块应用软件无需root 教你制作内置应用
  • Java设计模式七大原则
  • Copy as cURL 字段含义
  • mysql更改密码后,若依 后端启动不了解决方案
  • Redis--缓存击穿、缓存穿透、缓存雪崩
  • 10个理由告诉你,为什么鸿蒙是下一个职业风口!
  • Gitlab仓库的权限分配以及如何查看自己的权限
  • 职业本科大数据实训室
  • 【密码学】网络攻击类型:窃听攻击、假冒攻击、欺骗攻击和重放攻击
  • 探索WebKit的奥秘:塑造高效、兼容的现代网页应用
  • 2-52 基于matlab局部信息的模糊C均值聚类算法(FLICM)
  • JAVASE
  • SpringBoot学习之EasyExcel解析合并单元格(三十九)
  • 【Kimi学习笔记】C/C++、C#、Java 和 Python