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调色板应用(四) 不同区域颜色选择的颜色生成响应 上一篇讲过了主体界面的绘制,这里讲解调色板应用中的另外一 ...
随机推荐
- Xcode6中segue取消原push与modal(deprecated)
xcode6 之后push 和modal 就被废弃了.只能用于ios8之前.在拖线的时候我们就可以看见. 这两个方法被废弃了,我们需要找到合适的方法来代替,这时候我们发现 show 和Present ...
- Visual Studio 中的头文件、源文件和资源文件都是什么?有什么区别??
头文件:后缀为.h,主要是定义和声明之类的,比如类的定义,常量定义源文件:后缀.cpp,主要是实现之类的,比如类方法的实现资源文件主要是你用到的一些程序代码以外的东西,比如图片之类,或者菜单.工具栏之 ...
- JS中javascript:void(0)真正含义
对于下面的代码,其中void(0)的含义是什么? <a href="javascript:Test();void(0);">hello</a> 其实,Jav ...
- 笔记本安装Win2012R2 心得(包含无线网卡+有线网卡驱动解决方法)
笔记本:联想昭阳E47G 无线网卡安装方法: 系统安装完毕后将自动识别无线网卡驱动,但需要手动允许WLAN服务开启.(建议,如果是拿来办公或者家用,可以安装上桌面体验)不然,QQ发的截图双击都看不起. ...
- C# Delete Url Cookie
public static void DeleteCookieFile(Uri url) { string path = Environment.GetFolderPath(Environment.S ...
- IOS界面切换
好吧!表示这几天要实现 phonegap 打开IOS原生界面,因此也查询了一些方案. 有如下几种: 第一种:navigationcontroller //进入下层 [self.navigationC ...
- Java面向对象的三大特征
Java面向对象的三大特征 java面向对象的三大特征:“封装.继承.多态”.更多Java技术知识,请登陆疯狂软件教育官网.微信搜索微信号:疯狂软件,参加2015年优惠活动,有机会获得优惠劵和代金劵. ...
- Cocoa Drawing
Graphics Contexts Graphics contexts are a fundamental part of the drawing infrastructure in Cocoa ap ...
- hdu 2075
PS:水得不能再水..刚开始还以为是大数..要用到快速幂...谁知道想太多...就普通int型.. 代码: #include "stdio.h" int main(){ int a ...
- Combination Sum 和Combination Sum II
这两道题的基本思路和combination那一题是一致的,也是分治的方法. 其中combination Sum复杂一点,因为每个数可能用多次.仔细分析下,本质上也是一样的.原来是每个数仅两种可能.现在 ...