1、相关属性

  GridLayout网格布局是4.0之后引入的布局方式!

    android:columnCount="4" //设置列数(4列)
android:rowCount="6" //设置行数(6行)
android:orientation="horizontal" //设置排列方式(默认竖直)
android:layout_gravity="fill" //设置对齐方式
android:layout_columnSpan="4" //横向横跨几列(4列)
android:layout_rowSpan="4" //纵向横跨几行(4行)
android:layout_row="2" //设置组件在第几行(第二行)
android:layout_column="2" //设置组件在第几列(第二列)

2、简单使用

  组件默认占一行一列

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:columnCount="4"
android:orientation="horizontal"
android:id="@+id/GirdLayout1"
android:rowCount="6"
tools:context="com.example.xianfengzhang.cleartext.GirdActivity"> <TextView
android:layout_columnSpan="4"
android:layout_gravity="fill"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#ffcccc"
android:text="0"
android:gravity="right|bottom"
android:textSize="50sp"/>
<Button
android:layout_columnSpan="2"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:text="回退"/>
<Button
android:layout_columnSpan="2"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:text="清空"/>
<Button android:text="+" /> <Button android:text="1" /> <Button android:text="2" /> <Button android:text="3" /> <Button android:text="-" /> <Button android:text="4" /> <Button android:text="5" /> <Button android:text="6" /> <Button android:text="*" /> <Button android:text="7" /> <Button android:text="8" /> <Button android:text="9" /> <Button android:text="/" /> <Button android:text="." /> <Button android:text="0" /> <Button android:text="=" /> </GridLayout>

效果图

Android之GridLayout网格布局的更多相关文章

  1. Android精通:TableLayout布局,GridLayout网格布局,FrameLayout帧布局,AbsoluteLayout绝对布局,RelativeLayout相对布局

    在Android中提供了几个常用布局: LinearLayout线性布局 RelativeLayout相对布局 FrameLayout帧布局 AbsoluteLayout绝对布局 TableLayou ...

  2. Android零基础入门第32节:新推出的GridLayout网格布局

    原文:Android零基础入门第32节:新推出的GridLayout网格布局 本期主要学习的是网格布局是Android 4.0新增的布局,和前面所学的TableLayout表格布局 有点类似,不过他有 ...

  3. android——学习:网格布局——GridLayout

    Android一开始就提供了几种布局控件,如线性布局LinearLayout.相对布局RelativeLayout和表格布局TableLayout等,但在很多情况下,这些布局控件是不能满足要求的,因此 ...

  4. android的布局-----GridLayout(网格布局)

    学习导图 (一)简介 网格布局由GridLayout所代表,在android4.0之后新增加的布局管理器,因此需要android4.0之后的版本中使用,如果在更早的平台使用该布局管理器,则需要导入相应 ...

  5. GridLayout(网格布局)

    常用属性: 排列对齐: ①设置组件的排列方式:  android:orientation=""     vertical(竖直,默认)或者horizontal(水平) ②设置组件的 ...

  6. GridLayout网格布局

    网格布局特点: l  使容器中的各组件呈M行×N列的网格状分布. l  网格每列宽度相同,等于容器的宽度除以网格的列数. l  网格每行高度相同,等于容器的高度除以网格的行数. l  各组件的排列方式 ...

  7. Android——gridLayout(网格布局)

    <?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android=" ...

  8. java 图形化小工具Abstract Window Toolit ;布局管理器FlowLayout流式布局;BorderLayout边界布局;GridLayout网格布局;CardLayou重叠卡片布局;BoxLayout方框布局;绝对定位

    1.FlowLayout流式布局管理器: FlowLayout布局管理器中,组件像水流一样向某方向流动(排列),遇到障碍(边界)就折回,重头开始排列 .在默认情况下,FlowLayout局管理器从左向 ...

  9. 浅谈GridLayout(网格布局)

    Android 4.0 布局-->GridLayout 网格布局 以行列单元格的形式展示内部控件排列,可以实现类似计算机键盘效果 ,也可以实现可自动变行的标签群效果 使用GridLayout , ...

随机推荐

  1. WebApi的Swagger多版本控制实现

    WebApi + Swagger2.0接口文档多版本控制设计实现 最近前后端分离的项目越来越多,API的对接对于前后端开发交流得最多的一块内容,一个好的API文档生成工具就显得非常重要,选取了Swag ...

  2. Java 几种队列区别的简单说明

    前言 队列,字面意思就可以明白. 是一种线性的数据暂存与管理工具. 也可以让各种业务功能进行逐个的队列运行. 此篇博客只说明一下Java有几种队列 未阻塞和阻塞队列的区别 未阻塞: 1.未阻塞的队列在 ...

  3. Python中虚拟环境venv的基本用法

    环境windows 7 venv为python3中的默认库,无需安装. 创建新的venv方法, 在当前文件夹下执行cmd,输入如下代码 python -m venv bob bob为需要创建的文件夹名 ...

  4. 专访阿里云MVP王俊杰:开发者的超能力是用技术让世界更美好

    [王俊杰:阿里云MVP,陕西创博网络科技有限公司总经理.大数据与物联网的爱好者与实践者. 8年以上互联网从业经验,曾从事军工相关仿真分析软件研发与集成.4年以上大数据系统开发经验.目前正与天水市秦州区 ...

  5. Django项目:堡垒机(Linux服务器主机管理系统)--02--02堡垒机设计后台交互程序

    #main.py #本文件写所有的连接交互动作程序 #————————————————02堡垒机设计后台交互程序 开始———————————————— from django.contrib.auth ...

  6. POJ-3264-Balanced Lineup-线段树模板题-查询区间内最大值和最小值之差

    For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One d ...

  7. Python3中面向对象 OOP

    Python3中面向对象 OOP 定义: python中通过关键字 class 实现类的定义: class ClassName(object): pass 获取成员变量:ClassName.变量名 修 ...

  8. 0讲Java,给你一条简单清晰的学习道路!

    1. 计算机基础: 1.1 数据结构基础: 主要学习:1.向量,链表,栈,队列和堆,词典.熟悉2.树,二叉搜索树.熟悉3.图,有向图,无向图,基本概念4.二叉搜索A,B,C类熟练,9大排序熟悉.5.树 ...

  9. OA系统和ERP系统的区别

    一.OA和ERP的区别 1.含义不同: OA指Office Automation,中文简称自动办公系统,帮助企业内部管理沟通的工具,比如新闻公告.内部沟通.考勤.办公.员工请假.审批流程等. ERP指 ...

  10. mount: you must specify the filesystem type

    最近工作中遇到一个问题,在linux mount /dev/vdb 到 /home 分区时报错:   1 2 # mount /dev/vdb /home mount: you must specif ...