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

Android布局【TableLayout】

文章目录

  • 说明
  • 常见属性
    • 子控件设置属性
  • 项目结构
  • 主要代码

说明

TableLayout也称为表格布局

常见属性

  1. android:collapseColumns:设置需要被隐藏的列的序列号,从0开始
  2. android:stretchColumns:设置允许被拉伸的列的列序号,从0开始,拉伸占据的是剩余的空间
  3. android:shrinkColumns:设置允许被收缩的列的列序号,从0开始

子控件设置属性

  1. android:layout_column:显示在第几列
  2. android:layout_span:横向跨几列

项目结构

在这里插入图片描述

主要代码

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:shrinkColumns="4"android:stretchColumns="1"><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮1" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮2" /><TableRow><Buttonandroid:layout_column="1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮0" /><Buttonandroid:layout_span="2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮1" /></TableRow><TableRow><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮0" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮1" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮2" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮3" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮4" /></TableRow><TableRow><Buttonandroid:layout_column="1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮0"/><Buttonandroid:layout_column="3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="按钮1"/></TableRow></TableLayout>
http://www.lryc.cn/news/125896.html

相关文章:

  • C/C++中static关键字详解
  • Memory Analyzer(MAT)分析内存
  • 计算机网络面试题
  • 【LeetCode75】第三十题 奇偶链表
  • docker 学习--03 环境安装(本人使用的win10 Linux也是在win10下模拟)
  • 【代码质量】认知复杂度(COGNITIVE COMPLEXITY)一种衡量可理解性的新方法
  • 什么是JavaScript中的内存泄漏和如何避免内存泄漏?
  • 安全头响应头(三)​X-Content-Type-Options
  • 13 计算机视觉-代码详解
  • jupyter打开ipynb后,还没有运行cell,反复报错
  • 一台阿里云服务器怎么部署多个网站?以CentOS系统为例
  • history记录日期时间和日志记录操作
  • RocketMQ 单机源码部署 自定义配置文件和端口以及acl权限配置解析
  • NuGet控制台命令初步使用
  • 2023年国赛数学建模思路 - 案例:FPTree-频繁模式树算法
  • Positive Technologies:有针对性的攻击占非洲所有攻击的 68%
  • Flink CDC系列之:TiDB CDC 导入 Elasticsearch
  • 未来混合动力汽车的发展:技术探索与前景展望
  • C进阶(2/7)前篇——指针进阶
  • C 内存分配器 mimalloc
  • leetcode做题笔记74搜索二维矩阵
  • 深信服数据中心管理系统 XXE漏洞复现
  • 【Kubernetes】Kubernetes的Pod进阶
  • 都错了!机械硬盘远比SSD更省电 最多领先94%
  • tomcat设置PermSize
  • JVM——分代收集理论和垃圾回收算法
  • jar包独立运行的几种方式
  • [python] 安装numpy+scipy+matlotlib+scikit-learn及问题解决
  • uniapp使用命令创建页面
  • Linux(进程控制)