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调色板应用(四) 不同区域颜色选择的颜色生成响应 上一篇讲过了主体界面的绘制,这里讲解调色板应用中的另外一 ...
随机推荐
- web安全 -- 常见攻击方法及预防措施
一.sql注入 sql注入,是指攻击者在猜测出服务器上要执行sql后:通过输入数据,拼接原来要执行的sql而形成新的sql:从而到达改变原来查询的意义的目的. -- 原来sql select xxx ...
- iOS知名第三方框架和流行APP们所用的第三方框架小结
网易新闻AppleReachabilityASIHTTPRequestEGOTableViewPullRefreshGTMNSString+HTMLMGTemplateEngineMPOAuthReg ...
- Android手机号码不是所有的都能获取
手机号码不是所有的都能获取.只是有一部分可以拿到.这个是由于移动运营商没有把手机号码的数据写入到sim卡中.SIM卡只有唯一的编号,供网络与设备识别那就是IMSI号码,手机的信号也可以说是通过这个号码 ...
- 一道面试题,简单模拟spring ioc
自己实现的,程序写的土了点,很多情况没去考虑,主要是复习理解怎么使用反射来实现spring 的依赖注入. package dom4jtest; import java.lang.reflect.Inv ...
- iis提示“另一个程序正在使用此文件,进程无法访问。(异常来自HRESULT:0x80070020)
看看IIS的网站,惊人的发现default web site是停止状态.印象中没有停止它啊.右键->管理网站->启动.点击启动后居然弹出:“另一个程序正在使用此文件,进程无法访问.(异常来 ...
- pdo 的配置与启用
PDO(PHP Data Object)扩展在PHP5中加入,PHP6中将默认识用PDO连接数据库,所有非PDO扩展将会在PHP6被从扩展中移除.该扩展提供PHP内置类 PDO来对数据库进行 访问,不 ...
- 使用HttpOnly提升Cookie安全性
在介绍HttpOnly之前,我想跟大家聊聊Cookie及XSS. 随着B/S的普及,我们平时上网都是依赖于http协议完成,而Http是无状态的,即同一个会话的连续两个请求互相不了解,他们由最 ...
- 利用strut2标签自动生成form前端验证代码
利用strut2标签自动生成form前端验证代码,使用到的技术有1.struts2标签,如<s:form> <s:textfieled>2.struts2读取*Validati ...
- JQuery基础DOM操作
DOM创建节点及节点属性 通过JavaScript可以很方便的获取DOM节点,从而进行一系列的DOM操作.但实际上一般开发者都习惯性的先定义好HTML结构,但这样就非常不灵活了. 试想下这样的情况:如 ...
- simple grammer
<?phpecho strlen("Hello world!"); // outputs 12?> <?phpecho str_word_count(" ...