代码如下:

 <?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1"> <TableRow>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="标准"
android:layout_weight="1"
android:textSize="20sp"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="科学"
android:layout_weight="1"
android:textSize="20sp"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="换算"
android:layout_weight="1"
android:textSize="20sp"/>
</TableRow>
<TableRow android:layout_weight="1">
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right|bottom"
android:layout_span="4"
android:background="#ccc"/>
</TableRow>
<TableRow >
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="c"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="←"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="π"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"
android:textAllCaps="false"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="+"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
</TableRow>
<TableRow >
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="7"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="8"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="9"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="-"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
</TableRow>
<TableRow>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="4"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="5"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="6"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="×"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
</TableRow>
<TableRow>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="1"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="2"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="3"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="÷"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
</TableRow>
<TableRow >
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="( )"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="0"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="·"
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
<Button android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="="
android:layout_weight="1"
android:textSize="30sp"
android:layout_gravity="center"/>
</TableRow>
</TableLayout>

效果如图:

想把“=”纵向排列,但是好像TableLayout不支持,百度说嵌套,也没想出来,就加了个“π”

Android仿计算器界面的更多相关文章

  1. Android仿微信界面

    效果图 原理介绍 1.先绘制一个颜色(例如:粉红) 2.设置Mode=DST_IN 3.绘制我们这个可爱的小机器人 回答我,显示什么,是不是显示交集,交集是什么?交集是我们的小机器人的非透明区域,也就 ...

  2. Android仿微信界面--使用Fragment实现(慕课网笔记)

    1 效果图  这里我们没有实现滑动切换view的功能 2 具体实现: 2.1 布局文件:top.xml, bottom.xml,tab01.xml,tab02.xml,tab03.xml,tab04. ...

  3. Android仿QQ界面

    最近这几天,一直跟着朋友们聚会什么的,没怎么做项目,今天总算是有时间开电脑继续做我的项目了.下面我就把我做的效果展示一下. 这是模仿了qq的界面效果.因为代码比较长就不粘贴代码了.需要的小伙伴可以跟我 ...

  4. Android 仿QQ界面的实现

    废话不说  上图  适合新手学习 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQ ...

  5. Android 仿PhotoShop调色板应用(三) 主体界面绘制

    版权声明:本文为博主原创文章,未经博主允许不得转载. Android 仿PhotoShop调色板应用(三) 主体界面绘制    关于PhotoShop调色板应用的实现我总结了两个最核心的部分:   1 ...

  6. android仿系统Launcher界面,实现分屏,左右滑动效果(ViewSwitcher)

    ViewSwitcher代表了视图切换组件, 本身继承了FrameLayout ,可以将多个View叠在一起 ,每次只显示一个组件.当程序控制从一个View切换到另个View时,ViewSwitche ...

  7. Android ActionBar仿微信界面

    ActionBar仿微信界面 1.学习了别人的两篇关于ActionBar博客,在结合别人的文章来仿造一下微信的界面: 思路如下:1).利用ActionBar生成界面的头部,在用ActionBar的Ac ...

  8. Android 仿QQ消息界面

    values 下面 dimens.xml <resources> <!-- Default screen margins, per the Android Design guidel ...

  9. Android 仿PhotoShop调色板应用(四) 不同区域颜色选择的颜色生成响应

    版权声明:本文为博主原创文章,未经博主允许不得转载.  Android 仿PhotoShop调色板应用(四) 不同区域颜色选择的颜色生成响应  上一篇讲过了主体界面的绘制,这里讲解调色板应用中的另外一 ...

随机推荐

  1. 最大联通子数组之和(dfs,记忆化搜索,状态压缩)

    最大联通子数组,这次的题目,我采用的方法为dfs搜索,按照已经取到的数v[][],来进行搜索过程的状态转移,每次对v[][]中标记为1的所有元素依次取其相邻的未被标记为1的元素,将其标记为1,然而,这 ...

  2. exit(0)与exit(1)、return区别

    exit(0):正常运行程序并退出程序: exit(1):非正常运行导致退出程序: return():返回函数,若在主函数中,则会退出函数并返回一值. 详细说: 1. return返回函数值,是关键字 ...

  3. git初识

    下载网上的开发员的项目 git clone https://github.com/xxxxxx/test.git 下载好,进入刚下载的好的test项目目录,可以修改对应的代码,然后 git statu ...

  4. java基础之 泛型

    泛型(Generic type 或者generics)是对 Java 语言的类型系统的一种扩展,以支持创建可以按类型进行参数化的类.可以把类型参数看作是使用参数化类型时指定的类型的一个占位符,就像方法 ...

  5. 【转发】Linux下如何查看当前支持的文件系统及各分区的文件系统类型

    Linux下查看当前内核系统支持的文件系统: 一般都在 /lib/modules/kernl-version/kernel/fs/ 目录下包含了当前内核版本支持的文件系统: ls /lib/modul ...

  6. maven的入门hello world

    编写pom pom.xml是maven的核心.Project Object Model,定义了项目的基本信息,用于描述项目如何构建,项目依赖等. 首先,新建hello-world文件夹,新建pom.x ...

  7. Android模拟器配置选项说明

    Memory Options是模拟器的运行内存大小,类比电脑内存大小,就是在设置->应用程序中,正在运行标签页下面显示的那个大小Internal storage是模拟器内置存储空间大小,用于存放 ...

  8. HYSBZ 1415 - 聪聪和可可(概率DP)

    http://vjudge.net/problem/viewProblem.action?id=20613 题意:不用说了,中文题. 这个题可以用概率DP来做. 题中要求猫抓到老鼠的时间期望.分析一下 ...

  9. hdoj-2024

    #include "cstdio"#include "cstring"int compare(char s[]);int main(){ int i,n,j;  ...

  10. 使用iskindofclass来发现对象是否是某类或其子类的实例

    发现对象是否是特定类或其子类的实例 要发现对象是否是某类或其子类的实例,请在对象上调用 isKindOfClass: 方法.当应用程序需要发现其响应的消息(实现的或继承的),它有时进行以上的检查. s ...