Android仿计算器界面
代码如下:
<?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仿计算器界面的更多相关文章
- Android仿微信界面
效果图 原理介绍 1.先绘制一个颜色(例如:粉红) 2.设置Mode=DST_IN 3.绘制我们这个可爱的小机器人 回答我,显示什么,是不是显示交集,交集是什么?交集是我们的小机器人的非透明区域,也就 ...
- Android仿微信界面--使用Fragment实现(慕课网笔记)
1 效果图 这里我们没有实现滑动切换view的功能 2 具体实现: 2.1 布局文件:top.xml, bottom.xml,tab01.xml,tab02.xml,tab03.xml,tab04. ...
- Android仿QQ界面
最近这几天,一直跟着朋友们聚会什么的,没怎么做项目,今天总算是有时间开电脑继续做我的项目了.下面我就把我做的效果展示一下. 这是模仿了qq的界面效果.因为代码比较长就不粘贴代码了.需要的小伙伴可以跟我 ...
- Android 仿QQ界面的实现
废话不说 上图 适合新手学习 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQ ...
- Android 仿PhotoShop调色板应用(三) 主体界面绘制
版权声明:本文为博主原创文章,未经博主允许不得转载. Android 仿PhotoShop调色板应用(三) 主体界面绘制 关于PhotoShop调色板应用的实现我总结了两个最核心的部分: 1 ...
- android仿系统Launcher界面,实现分屏,左右滑动效果(ViewSwitcher)
ViewSwitcher代表了视图切换组件, 本身继承了FrameLayout ,可以将多个View叠在一起 ,每次只显示一个组件.当程序控制从一个View切换到另个View时,ViewSwitche ...
- Android ActionBar仿微信界面
ActionBar仿微信界面 1.学习了别人的两篇关于ActionBar博客,在结合别人的文章来仿造一下微信的界面: 思路如下:1).利用ActionBar生成界面的头部,在用ActionBar的Ac ...
- Android 仿QQ消息界面
values 下面 dimens.xml <resources> <!-- Default screen margins, per the Android Design guidel ...
- Android 仿PhotoShop调色板应用(四) 不同区域颜色选择的颜色生成响应
版权声明:本文为博主原创文章,未经博主允许不得转载. Android 仿PhotoShop调色板应用(四) 不同区域颜色选择的颜色生成响应 上一篇讲过了主体界面的绘制,这里讲解调色板应用中的另外一 ...
随机推荐
- Quartz 2D 图形上下文栈 矩阵 裁剪
Quartz 2D 图形上下文栈 矩阵 // // DJVIew.m // 图形上下文栈 // // Created by zjj on 15/6/30. // Copyright (c) 2015 ...
- Cisco IOS Security command Guide
copy system:running-config nvram:startup-config : to save your configuration changes to the startup ...
- 在网页中编辑报表的报表设计器Stimulsoft Reports Designer.Web报表控件
Stimulsoft Reports Designer.Web报表控件是一款网页报表设计器.您想在网页中编辑您的报表吗?现在是可能的! Stimulsoft Reports Designer.Web ...
- DotNetBar v12.9.0.0 Fully Cracked
更新信息: http://www.devcomponents.com/customeronly/releasenotes.asp?p=dnbwf&v=12.9.0.0 如果遇到破解问题可以与我 ...
- ODI中web service介绍
ODI WS架构
- 理解NSAttributedString
An NSAttributedString object manages character strings and associated sets of attributes (for exampl ...
- 一篇介绍jquery中的ajax的结合
<script type="text/javascript"> function Text_ajax() { $.aja ...
- PAT 06-1 简单计算器
想看一般简单计算器实现的看客不好意思了,这不是你想要点东西,此处题设为“只能进行加减乘除”.“都是整数”.”优先级相同“和"从左到右".此题来自PAT(http://www.pat ...
- XML元素和结点的区别
1.区别介绍 Element是Node的扩展,所以也更实用一些.例如,用Element可以方便的获得Node的属性getAttribute(String attrName)如果用Node,可以得到一个 ...
- application:didFinishLaunchingWithOptions:详解
iOS 程序启动时总会调用application:didFinishLaunchingWithOptions:,其中第二个参数launchOptions为NSDictionary类型的对象,里面存储有 ...