android线性布局作业——计算器
来源:互联网 发布:知豆新能源资质 编辑:程序博客网 时间:2024/05/17 22:53
把计算器分为1:6,文本框为一份,剩下的为6份;再把6份分为4:2,规则的文本框为4份,不规则位2份;再把不规则的竖直分为3:1,数字为三分,符号位一份;把数字分为1:1,上面一份,下面一份;在把每一份的按钮填上去就好了。需要注意的是按比例填充按钮时要把高度设为0dp,注意竖直划分与水平划分时,
高度与宽度。
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" 99999999" android:textSize="35dp"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_weight="6" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="4" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text10" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text11" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text12" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text13" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text17" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text18" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_3" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text15" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text7" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_6" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_9" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text16" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_11" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_12" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_13" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_14" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="2" android:orientation="horizontal"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_15" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_16" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_17" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_20" /> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:text="@string/text_21" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" > <Button android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/text_22" /> </LinearLayout> </LinearLayout> </LinearLayout></LinearLayout>
0 0
- android线性布局作业——计算器
- 线性布局小实现——计算器的简单布局
- android线性布局之计算器界面设计
- android学习--adroid线性布局 一个计算器的布局
- Android布局——线性布局、相对布局
- Android入门笔记之线性布局(计算器)
- 表格布局—计算器
- Android UI 开发入门—线性布局
- Android实现计算器布局(四种布局方式)之LinearLayout线性布局
- android基础——界面布局(二) 线性布局
- Android【布局管理器】——线性布局LinearLayout
- 线性布局--简单计算器的布局
- 线性布局Linerlayout-计算器布局实现
- LinearLayout—线性布局
- Android——Tabel布局,计算器的实现
- 布局——线性布局、相对布局
- Android计算器界面布局
- Android计算器布局
- mongodb you can't add a second 问题
- Baas
- 支付宝开发详解
- QT4保存调试日志
- MapReduce:详解Shuffle过程
- android线性布局作业——计算器
- 39 二叉树的深度和宽度以及判断是否是平衡二叉树
- dTree 动态生成树(http://luohua.iteye.com/blog/451453)
- 动态规划的优化技巧
- 大话倒车后视摄像头产品系统设计 - 基于芯片商提供的SDK API开发之四
- javascript性能优化-repaint和reflow
- secureCRT+secureFX相关
- centos 6.5 搭建 redis
- 安卓jni开发demo