<?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">
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#ccc"
android:layout_columnSpan="4"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="C"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="DEL"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="÷"
android:textSize="35sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="x"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="7"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="8"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1" />
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="9"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="-"
android:textSize="35sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="4"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="5"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="6"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="+"
android:textSize="30sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="1"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="2"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="3"
android:textSize="25sp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="="
android:textSize="30sp"
android:layout_rowSpan="2"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="0"
android:textSize="25sp"
android:layout_columnSpan="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1" />
<Button
android:layout_width="0dp"
android:layout_height="0dp"
android:text="."
android:textSize="25dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"/> </GridLayout>

GridLayout 计算器的更多相关文章

  1. 用GridLayout实现计算器的布局

    GridLayout是一个表格视图,我们一般定义它的列数和行数来设置好这个控件. 下面的布局文件先定义了一个TextView和一个Button,设置他们的属性为横跨4列.这样就可以独自占据一行了.然后 ...

  2. 菜鸟学Android编程——简单计算器《一》

    菜鸟瞎搞,高手莫进 本人菜鸟一枚,最近在学Android编程,网上看了一些视频教程,于是想着平时手机上的计算器应该很简单,自己何不尝试着做一个呢? 于是就冒冒失失的开撸了. 简单计算器嘛,功能当然很少 ...

  3. java简单计算器

    写的一个小计算器,留着以后看吧. import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import ...

  4. Pyqt QTabWidget 简单的计算器集合

    今天我们简单介绍下QTabWidget,然后在加入Demo计算器 首先我先讲下文件的结构: 文件分四部分, 一部分是Ui设计文件, 一部分是由Ui生成的py文件, 一部分是 计算器的逻辑文件,  最后 ...

  5. Android课程---计算器的实现

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

  6. 案例:TableLayout表格布局——迷你计算器

    计算器可以常用线性布局(LinearLayout)和表格布局(tableLayout).Gridlayout 今天我用的是表格布局 效果如下: 代码如下: <TableLayout xmlns: ...

  7. Android 布局之GridLayout

    Android 布局之GridLayout 1 GridLayout简介 GridLayout是Android4.0新提供的网格矩阵形式的布局控件. GridLayout的继承关系如下:java.la ...

  8. Java SWT 做计算器。

    java  --  swt  - -  计算器 环境搭建 安装java.eclipse.以及对应的swt插件. 开始工程 建立工程: 在java下建立一个在其他 —- WindowsBuilder — ...

  9. 科学计算器的Java实现

    简易的科学计算器的实现 ---Java版 import javax.swing.*;//新的窗口组件包 import java.awt.*; import java.awt.event.*; publ ...

随机推荐

  1. 一个最简单的使用Entity Framework 查询SQL 数据库的例子

    1.ADO.NET 3.5 Entity Framework是随着.net framework 3.5一起发布的,确认开发环境版本是大于等于3.5版本 2.确认已经安装了ADO.NET 3.5 Ent ...

  2. intval floatval

    intval -- 获取变量的整数值 floatval -- 获取变量的浮点值 <?php $a = ; $b = ; $a/=$b; echo intval($a); echo floatva ...

  3. Kubernetes集群部署--kubernetes1.10.1

    参考博客:https://mritd.me/2018/04/19/set-up-kubernetes-1.10.1-cluster-by-hyperkube/ 一.环境 (1)系统环境 IP 操作系统 ...

  4. shell比较浮点数和整数

    今天有一个朋友忽然问我在shell中,如何比较浮点数和整数,倒是把我问的一愣,在工作中确实没有遇到这个场景.我们也知道,在shell中数字的计算通常都会转换成整数,比如说1.1和1会被认为是一样的.这 ...

  5. python---基础知识回顾(六)网络编程

    python---基础知识回顾(十)进程和线程(进程) python---基础知识回顾(十)进程和线程(多线程) python---基础知识回顾(十)进程和线程(自定义线程池) 一:Socket (一 ...

  6. 在嵌入式Linux系统(OK6410)中移植Boa 服务器

    OK6410的Boa服务器移植: <一> Boa的编译 1. 从 www.boa.org 下载 Boa 服务器的最新版:boa-0.94.13.tar.gz. 2. 解压:tar xzf ...

  7. SQL Server DB Link相关

    若想通过DBlink 清空表或执行存储过程,可以通过这种方式 Insert into table select * from table时,Pull 方式比Push方式快很多

  8. 2018ICPC青岛赛区J题

    题目链接:http://acm.zju.edu.cn/onlinejudge/showRuns.do?contestId=1 这题真的坑,为什么要买0本书的时候,书架里面刚好有价格为0的时候输出&qu ...

  9. [转]使用 C++11 编写 Linux 多线程程序

    前言 在这个多核时代,如何充分利用每个 CPU 内核是一个绕不开的话题,从需要为成千上万的用户同时提供服务的服务端应用程序,到需要同时打开十几个页面,每个页面都有几十上百个链接的 web 浏览器应用程 ...

  10. 在JS数组指定位置插入元素

    很多与数组有关的任务听起来很简单,但实际情况并不总是如此,而开发人员在很多时候也用不到他.最近我碰到了这样一个需求: 将一个元素插入到现有数组的特定索引处.听起来很容易和常见,但需要一点时间来研究它. ...