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">
<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 计算器的更多相关文章
- 用GridLayout实现计算器的布局
GridLayout是一个表格视图,我们一般定义它的列数和行数来设置好这个控件. 下面的布局文件先定义了一个TextView和一个Button,设置他们的属性为横跨4列.这样就可以独自占据一行了.然后 ...
- 菜鸟学Android编程——简单计算器《一》
菜鸟瞎搞,高手莫进 本人菜鸟一枚,最近在学Android编程,网上看了一些视频教程,于是想着平时手机上的计算器应该很简单,自己何不尝试着做一个呢? 于是就冒冒失失的开撸了. 简单计算器嘛,功能当然很少 ...
- java简单计算器
写的一个小计算器,留着以后看吧. import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import ...
- Pyqt QTabWidget 简单的计算器集合
今天我们简单介绍下QTabWidget,然后在加入Demo计算器 首先我先讲下文件的结构: 文件分四部分, 一部分是Ui设计文件, 一部分是由Ui生成的py文件, 一部分是 计算器的逻辑文件, 最后 ...
- Android课程---计算器的实现
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="ht ...
- 案例:TableLayout表格布局——迷你计算器
计算器可以常用线性布局(LinearLayout)和表格布局(tableLayout).Gridlayout 今天我用的是表格布局 效果如下: 代码如下: <TableLayout xmlns: ...
- Android 布局之GridLayout
Android 布局之GridLayout 1 GridLayout简介 GridLayout是Android4.0新提供的网格矩阵形式的布局控件. GridLayout的继承关系如下:java.la ...
- Java SWT 做计算器。
java -- swt - - 计算器 环境搭建 安装java.eclipse.以及对应的swt插件. 开始工程 建立工程: 在java下建立一个在其他 —- WindowsBuilder — ...
- 科学计算器的Java实现
简易的科学计算器的实现 ---Java版 import javax.swing.*;//新的窗口组件包 import java.awt.*; import java.awt.event.*; publ ...
随机推荐
- 网络优化之net.ipv4.tcp_tw_recycle参数
不要在linux上启用net.ipv4.tcp_tw_recycle参数 2015/07/27 CFC4N 本文为翻译英文BLOG<Coping with the TCP TIME-WAIT ...
- Unmanaged Exports生成Dll时的一些疑难杂症疗法
Unmanaged Exports是一个将.NET编写的静态托管函数导出成可供C/C++等直接调用的非托管函数的工具. 已经在上篇文章介绍过了,这里不再复述. 限制 你不能导出在同一个class中的重 ...
- 转:Launch Screen在iOS7/8中的实现
目前项目中需要解决的问题是: 兼容iOS7和iOS8,之前的版本不需要支持了 实现兼容3.5.4.4.7和5.5寸屏幕,竖屏的Lauch Screen 创建所需的PNG图片 有关iPhone6/6+相 ...
- 博世传感器调试笔记(一)----加速度传感器BMA253
公司是bosch的代理商,最近一段时间一直在公司开发的传感器demo板上调试bosch sensor器件.涉及到的器件有7,8款,类型包括重力加速度.地磁.陀螺仪.温度.湿度.大气压力传感器等.在调试 ...
- 蓝桥杯 算法提高 学霸的迷宫 经典BFS问题
算法提高 学霸的迷宫 时间限制:1.0s 内存限制:256.0MB 问题描述 学霸抢走了大家的作业,班长为了帮同学们找回作业,决定去找学霸决斗.但学霸为了不要别人打扰,住在一个城 ...
- Elasticsearch技术解析与实战(五)Document解析
1.手动指定document id 一般来说,是从某些其他的系统中,导入一些数据到es时,会采取这种方式,就是使用系统中已有数据的唯一标识,作为es中document的id. PUT /index/t ...
- 【转】C#中Graphics的画图代码
C#中Graphics的画图代码[转] 架上图片了你就可以在画板上涂改了啊 我要写多几个字上去string str = "Baidu"; //写什么字?Font font = Fo ...
- 【leetcode 简单】 第七十四题 缺失数字
给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数. 示例 1: 输入: [3,0,1] 输出: 2 示例 2: 输入: [9,6,4,2 ...
- 【译】第八篇 SQL Server代理使用外部程序
本篇文章是SQL Server代理系列的第八篇,详细内容请参考原文 在这一系列的上一篇,学习了如何用SQL Server代理作业活动监视器监控作业活动和查看作业历史记录.在实时监控和管理SQL Ser ...
- C. Connect Three(构造)
题目链接:http://codeforces.com/contest/1087/problem/C 题目大意:给你三个点的坐标,让你用尽可能少的方块,让这三个点连起来. 具体思路: 我们先对这三个点进 ...