<?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. Java入门:用户登录与注册模块1(实践项目)——分析

    任务描述:用户登录与注册是大多数软件都拥有的一个模块.请编写一个控制台程序,实现用户的登录与注册功能,并且用户能够修改自己信息. [需求分析]由于本程序是一个演示程序,用户的信息我们做简化处理,仅包括 ...

  2. centos禁用ipv6

    两步完成 vi /etc/sysctl.conf net.ipv6.conf.all.disable_ipv6=1sysctl -p /etc/sysctl.conf

  3. java synchronized 的原理。

    synchronized的作用大概分为三种: 1.确保多线程互斥的访问多线程代码.2.保证变量的可见性.3.防止指令重排序. 那么synchronized 是如何实现这些功能的. public cla ...

  4. 互斥量、条件变量与pthread_cond_wait()函数的使用,详解(一)

    1. 首先pthread_cond_wait 的定义是这样的 The pthread_cond_wait() and pthread_cond_timedwait() functions are us ...

  5. 悬浮按钮css

    .floating-button { color: #fff; position: absolute; right: 16px; bottom: 88px; width: 56px; height: ...

  6. 通过网络仓库建立本地的yum仓库

    [root@kazihuo ~]# yum -y install createrepo yum-utils [root@kazihuo ~]# yum -y install https://mirro ...

  7. [转载]Require.js Example – Setup Time 2 Minutes

    http://www.sitepoint.com/require-js-setup-time-2-minutes/ Setup Require.js in just 2 minutes. or dow ...

  8. [大数据测试]ETL测试或数据仓库测试入门

    转载自: http://blog.csdn.net/zhusongziye/article/details/78633934 概述 在我们学习ETL测试之前,先了解下business intellig ...

  9. input限制

    转载,暂未使用,可以借鉴. 出处:http://blog.csdn.net/a13590394462/article/details/73943785

  10. C语言实现线性表

    #include <stdio.h> #include <stdlib.h> //提供malloc()原型 /* 线性表需要的方法: 1. List MakeEmpty():初 ...