代码如下:

 <?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. UITextView添加一个placeholder功能

    控件UITextField有个placeholder属性,UITextField和UITextView使用方法基本类似,有两个小区别:1.UITextField单行输入,而UITextView可以多行 ...

  2. (转载)java常见的ClassNotFoundException

    1 - java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory   添加包common-logging.jar2 ...

  3. 本周实验的PSP0过程文档

    项目计划总结:       日期/任务      听课        编写程序         阅读相关书籍 日总计          周一      110           60         ...

  4. mysql 为某一数据库下所有表中添加相同字段

    BEGIN  DECLARE s_tablename VARCHAR(100);  /*显示表的数据库中的所有表 SELECT table_name FROM information_schema.t ...

  5. C++数据结构之Linked Stack(链式栈)

    上一节用连续的方式实现栈,这种方法用一个确定大小的数组存储栈元素,因为当存储达到数组上限时会遇到麻烦. 连续实现的栈与链式实现的栈的最大不同在于,前者使用一个确定大小的数组存储每一个栈元素,后者使用带 ...

  6. Map写入的顺序 输出地顺序ZT

    偶然间 发现hashmap遍历的结果不是放入的顺序 为了项目某个功能更人性话 思考了半天还是不知道如何下手 因为有种种条件限制 后来 无意中发现 java.util.LinkedHashMap< ...

  7. C# delegate & event

    public delegate void MyDelegate(string mydelegate);//声明一个delegate对象 //实现有相同参数和返回值的函数        public v ...

  8. POJ 2385 DP

    题意:在苹果树下,初始在第一棵树下,告诉你在第几秒的时候,那棵树下会落下苹果,告诉最多能移动的次数,然后来回移动,求能得到的最大的苹果数目. 思路:三维DP,d[第i秒][已经移动j次][当前在(1, ...

  9. Mobile phones_二维树状数组

    [题意]给你一个矩阵(初始化为0)和一些操作,1 x y a表示在arr[x][y]加上a,2 l b r t 表示求左上角为(l,b),右下角为(r,t)的矩阵的和. [思路]帮助更好理解树状数组. ...

  10. dat文件中如何编写DOS的多行命令

    dat文件中如何编写DOS的多行命令 2012-10-15 11:29 四海柔情108 分享到:   2012-10-16 23:36 提问者采纳   你问的应该是BAT文件吧?BAT是DOS命令的批 ...