android的布局-----GridLayout(网格布局)
学习导图

(一)简介
网格布局由GridLayout所代表,在android4.0之后新增加的布局管理器,因此需要android4.0之后的版本中使用,如果在更早的平台使用该布局管理器,则需要导入相应的支持库<android.support.v7.widget.GridLayout>
(二)案列----计算器
<?xml version="1.0" encoding="utf-8"?>
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rowCount="6"
android:columnCount="4"
android:layout_gravity="fill">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textSize="80sp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_columnSpan="4"
android:background="#eee"
android:padding="3sp"
android:editable="false"
android:textColor="#000"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_columnSpan="4"
android:text="清除"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="."
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="="
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
<Button
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:textColor="#000"
android:textSize="24dp"
android:layout_marginLeft="10dp"
android:background="@android:color/background_light"
/>
</GridLayout>
android的布局-----GridLayout(网格布局)的更多相关文章
- Android精通:TableLayout布局,GridLayout网格布局,FrameLayout帧布局,AbsoluteLayout绝对布局,RelativeLayout相对布局
在Android中提供了几个常用布局: LinearLayout线性布局 RelativeLayout相对布局 FrameLayout帧布局 AbsoluteLayout绝对布局 TableLayou ...
- Android零基础入门第32节:新推出的GridLayout网格布局
原文:Android零基础入门第32节:新推出的GridLayout网格布局 本期主要学习的是网格布局是Android 4.0新增的布局,和前面所学的TableLayout表格布局 有点类似,不过他有 ...
- Android之GridLayout网格布局
1.相关属性 GridLayout网格布局是4.0之后引入的布局方式! android:columnCount="4" //设置列数(4列) android:rowCount=&q ...
- GridLayout(网格布局)
常用属性: 排列对齐: ①设置组件的排列方式: android:orientation="" vertical(竖直,默认)或者horizontal(水平) ②设置组件的 ...
- 鸿蒙的js开发部模式16:鸿蒙布局Grid网格布局的应用一
鸿蒙入门指南,小白速来!从萌新到高手,怎样快速掌握鸿蒙开发?[课程入口]目录:1.Grid简介2.使用Grid布局实现的效果3.grid-row-gap和grid-colunm-gap属性4.< ...
- Android布局_网格布局GirdLayout
自Android4.0版本后新增的GirdLayout网格布局(API 14) <?xml version="1.0" encoding="utf-8"? ...
- GridLayout网格布局
网格布局特点: l 使容器中的各组件呈M行×N列的网格状分布. l 网格每列宽度相同,等于容器的宽度除以网格的列数. l 网格每行高度相同,等于容器的高度除以网格的行数. l 各组件的排列方式 ...
- 控件布局_FrameLayout(网格布局)
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&qu ...
- css布局 弹性布局 和 网格布局
这里就不写这两种布局的内容了 弹性布局链接:http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html 网格布局链接:https://www.ji ...
随机推荐
- CentOS Linux 安装IPSec+L2TP
第二层隧道协议L2TP(Layer 2 Tunneling Protocol)是一种工业标准的Internet隧道协议,它使用UDP的1701端口进行通信.L2TP本身并没有任何加密,但是我们可以使用 ...
- 用dump为什么总会在前面出现/path/debug.php:193
解决方案,在php.ini中的xdebug中加一行代码:xdebug.overload_var_dump=1
- 笔记-python-装饰器
笔记-python-装饰器 1. 装饰器 装饰器的实质是返回的函数对象的函数,其次返回的函数对象是可以调用的,搞清楚这两点后,装饰器是很容易理解的. 1.1. 相关概念理解 首先,要理解在Pyth ...
- uoj206 [APIO2016]最大差分
ref #include "gap.h" #include <iostream> #include <cstdio> using namespace std ...
- 矩阵儿快速幂 - POJ 3233 矩阵力量系列
不要管上面的标题的bug 那是幂的意思,不是力量... POJ 3233 Matrix Power Series 描述 Given a n × n matrix A and a positive in ...
- Group Policy Object Editor
Group Policy Object Editor The Group Policy Object Editor is a tool that hosts MMC extension snap- ...
- ogre3D,cegui配置问题
今天按照网上的教程配置CEGUI, 一直运行不了,不明白原因,而后又出现了错误 LNK1104: 无法打开文件“OgreGUIRenderer_d.lib”,经过反复检查,排除包含目录问题. 不过可能 ...
- plsql编程
ORACLE PL/SQL编程详解 SQL语言只是访问.操作数据库的语言,并不是一种具有流程控制的程序设计语言,而只有程序设计语言才能用于应用软件的开发.PL /SQL是一种高级数据库程序设计语言,该 ...
- 04 JVM是如何执行方法调用的(下)
虚方法调用 Java 里所有非私有实例方法调用都会被编译成 invokevirtual 指令,而接口方法调用会被编译成 invokeinterface 指令.这两种指令,均属于 Java 虚拟机中的虚 ...
- DataFrame的iloc与loc的区别是什么?
对于一个DataFrame A,A.loc[k]是读取A中index为k的那一行.A.iloc[k]是读取A中的第k行.