Android开发笔记(3)——GridLayout
笔记链接:http://www.cnblogs.com/igoslly/p/6799939.html
GirdLayout 计算器实例及详尽的笔记:http://www.cnblogs.com/skywang12345/p/3154150.html
网格布局:使容器中的各组件呈M行×N列的网格状分布。
和Relative Layout\Linear Layout相同,属于ViewGroup类型。
布局设置步骤
1、设置最大行、列值
android:columnCount=“5”
android:rowCount=“6”
2、设置数据输入顺序
android:orientation

3、设置行列权重
android:layout_columnWeight
android:layout_rowWeight
4、设置跨行、列格
android:layout_columnSpan="2"
示例:
篮球计分app,记录每一节比分表格
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:columnCount="6"
android:rowCount="3">
<TextView
android:text="Table"
style="@style/table_layout"/>
<TextView
android:text="1st"
style="@style/table_layout"/>
<TextView
android:text="2nd"
style="@style/table_layout"/>
<TextView
android:text="3rd"
style="@style/table_layout"/>
<TextView
android:text="4th"
style="@style/table_layout"/>
<TextView
android:text="TOTAL"
style="@style/table_layout"/>
<TextView
android:text="A"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_a_part1"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_a_part2"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_a_part3"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_a_part4"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_a_total"
style="@style/table_layout"/>
<TextView
android:text="B"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_b_part1"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_b_part2"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_b_part3"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_b_part4"
style="@style/table_layout"/>
<TextView
android:text="0"
android:id="@+id/score_b_total"
style="@style/table_layout"/>
</GridLayout>
显示效果:

申明:
1、本笔记为文字及图片均为个人原创,转载请注明博客园-igoslly
2、Android开发课程于2017年4年参与GoogleDeveloper进行学习,
Android开发笔记(3)——GridLayout的更多相关文章
- Android开发笔记:打包数据库
对于数据比较多的控制一般会加入SQLite数据库进行数据存储,在打包时这些数据库是不自动打包到apk中的,如何创建数据库呢 方法1:将创建数据库的sql语句在SQLiteHelper继承类中实现,在第 ...
- Android开发笔记--hello world 和目录结构
原文:Android开发笔记--hello world 和目录结构 每接触一个新东西 都有一个hello world的例子. 1.新建项目 2.配置AVD AVD 没有要新建个,如果不能创建 运行SD ...
- 【转】Android开发笔记(序)写在前面的目录
原文:http://blog.csdn.net/aqi00/article/details/50012511 知识点分类 一方面写写自己走过的弯路掉进去的坑,避免以后再犯:另一方面希望通过分享自己的经 ...
- [APP] Android 开发笔记 003-使用Ant Release 打包与keystore加密说明
接上节 [APP] Android 开发笔记 002 5. 使用ant release 打包 1)制作 密钥文件 release.keystore (*.keystore) keytool -genk ...
- [APP] Android 开发笔记 002-命令行创建默认项目结构说明
接上节:[APP] Android 开发笔记 001 4. 默认项目结构说明: 这里我使用Sublime Text 进行加载.
- Android开发笔记——以Volley图片加载、缓存、请求及展示为例理解Volley架构设计
Volley是由Google开源的.用于Android平台上的网络通信库.Volley通过优化Android的网络请求流程,形成了以Request-RequestQueue-Response为主线的网 ...
- Android开发笔记(一百三十四)协调布局CoordinatorLayout
协调布局CoordinatorLayout Android自5.0之后对UI做了较大的提升.一个重大的改进是推出了MaterialDesign库,而该库的基础即为协调布局CoordinatorLayo ...
- 【转】Android开发笔记——圆角和边框们
原文地址:http://blog.xianqu.org/2012/04/android-borders-and-radius-corners/ Android开发笔记——圆角和边框们 在做Androi ...
- 《ArcGIS Runtime SDK for Android开发笔记》
开发笔记之基础教程 ArcGIS Runtime SDK for Android 各版本下载地址 <ArcGIS Runtime SDK for Android开发笔记>——(1).And ...
- 《ArcGIS Runtime SDK for Android开发笔记》——离在线一体化技术:概述
1.前言 数据生产和数据展示是常见的两大专业级移动GIS应用场景,这里我们针对数据生产环节的ArcGIS的离在线一体化技术给大家做一个基本的介绍和梳理. 使用ArcGIS离在线一体化技术首先需要以下基 ...
随机推荐
- Python循环定时服务功能(相似contrab)
Python实现的循环定时服务功能.类似于Linux下的contrab功能.主要通过定时器实现. 注:Python中的threading.timer是基于线程实现的.每次定时事件产生时.回调完响应函数 ...
- mac中apache+mysql+php+phpMyAdmin配置备忘
Mac OS X 内置Apache 和 PHP,使用起来非常方便.本文以Mac OS X 10.6.3和为例.主要内容包括: 启动Apache 运行PHP 安装MySQL 使用phpMyAdmin 配 ...
- java7新特性之Try-with-resources (TWR)
java7新特性之Try-with-resources (TWR) This change is easy to explain, but it has proved to have hidden s ...
- Codechef Racing Horses题解
找一个数组中两数之间最小的不同值. 思路: 1 排序 2 后前相减,比較得到最小不同值 三个数甚至很多其它数之间的不同值都是这么求了,时间效率都是O(nlgn) -- 排序使用的时间 原题: http ...
- .net的程序的逆向分析。
背景:碰到一个由c#写的exe,由于之前没有分析过.net的程序,记录下分析流程. 1)peid加载判断类型,可以看出没有加壳. 2)搜索c#的反编译以及调试工具. 1.NET.Reflector以及 ...
- ios7 UIBarButtonItem 默认蓝色
[self.navigationItem setLeftBarButtonItem:leftButton]; 这样设置在ios7上button默认是蓝色 解决方法: leftButton.tintCo ...
- mySQL (关系型数据库管理系统)
MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下产品.MySQL 是最流行的关系型数据库管理系统之一,在 WEB 应用方面,MySQL是最好的 RD ...
- 01排序的Java实现
比赛描写叙述: 的个数同样时再按ASCII码值排序. 输入: 个字符. 输出: 串的顺序.使得串按基本描写叙述的方式排序. 例子输入: 例子输出: 被AC的代码例如以下: import java.ut ...
- CPU上电时序详细分析
首先是RTC电源,这部分电力是永远不关闭的,除非电池(纽扣电池)没电并且没接任何外部电源(比如电池和电源适配器). RTC用以保持机器内部时钟的运转和保证CMOS配置信息在断电的情况下不丢失:其次,在 ...
- CollapsingToolbarLayout Toolbar的title覆盖问题
CollapsingToolbarLayout 里: 1 2 app:titleEnabled="true" app:title="Hello" Toolbar ...