Android 计算器界面

高仿魅族魅蓝NOTE 2风格

 

  1 <?xml version="1.0" encoding="utf-8"?>
  2 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3     android:layout_width="match_parent"
  4     android:layout_height="match_parent"
  5     android:layout_row="4"
  6     android:stretchColumns="1">
  7     <EditText
  8         android:layout_width="387dp"
  9         android:layout_height="270dp"
 10         android:editable="true"
 11         android:inputType="number"
 12         android:textSize="30dp"
 13         android:background="#999">
 14     </EditText>
 15     <TableRow>
 16         <Button
 17             android:layout_width="wrap_content"
 18             android:layout_height="wrap_content"
 19             android:text="CE"
 20             android:textSize="20dp"
 21             android:background="#990"
 22             android:textColor="#FFF"/>
 23         <Button
 24             android:layout_width="wrap_content"
 25             android:layout_height="wrap_content"
 26             android:text="C"
 27             android:textSize="20dp"
 28             android:background="#990"
 29             android:textColor="#FFF"/>
 30         <Button
 31             android:layout_width="wrap_content"
 32             android:layout_height="wrap_content"
 33             android:textSize="20dp"
 34             android:background="#990"
 35             android:textColor="#FFF"
 36             android:text="%" />
 37         <Button
 38             android:layout_width="wrap_content"
 39             android:layout_height="wrap_content"
 40             android:text="+"
 41             android:textSize="20dp"
 42             android:background="#990"
 43             android:textColor="#FFF"/>
 44 
 45     </TableRow>
 46     <TableRow>
 47         <Button
 48             android:layout_width="wrap_content"
 49             android:layout_height="wrap_content"
 50             android:text="7"
 51             android:textSize="20dp"
 52             android:background="#999"
 53             android:textColor="#FFF"/>
 54         <Button
 55             android:layout_width="wrap_content"
 56             android:layout_height="wrap_content"
 57             android:text="8"
 58             android:textSize="20dp"
 59             android:background="#999"
 60             android:textColor="#FFF"/>
 61         <Button
 62             android:layout_width="wrap_content"
 63             android:layout_height="wrap_content"
 64             android:text="9"
 65             android:textSize="20dp"
 66             android:background="#999"
 67             android:textColor="#FFF"/>
 68         <Button
 69             android:layout_width="wrap_content"
 70             android:layout_height="wrap_content"
 71             android:text="-"
 72             android:textSize="20dp"
 73             android:background="#990"
 74             android:textColor="#FFF"/>
 75     </TableRow>
 76     <TableRow>
 77         <Button
 78             android:layout_width="wrap_content"
 79             android:layout_height="wrap_content"
 80             android:text="4"
 81             android:textSize="20dp"
 82             android:background="#999"
 83             android:textColor="#FFF"/>
 84         <Button
 85             android:layout_width="wrap_content"
 86             android:layout_height="wrap_content"
 87             android:text="5"
 88             android:textSize="20dp"
 89             android:background="#999"
 90             android:textColor="#FFF"/>
 91         <Button
 92             android:layout_width="wrap_content"
 93             android:layout_height="wrap_content"
 94             android:text="6"
 95             android:textSize="20dp"
 96             android:background="#999"
 97             android:textColor="#FFF"/>
 98         <Button
 99             android:layout_width="wrap_content"
100             android:layout_height="wrap_content"
101             android:text="X"
102             android:textSize="20dp"
103             android:background="#990"
104             android:textColor="#FFF"/>
105     </TableRow>
106     <TableRow>
107         <Button
108             android:layout_width="wrap_content"
109             android:layout_height="wrap_content"
110             android:text="1"
111             android:textSize="20dp"
112             android:background="#999"
113             android:textColor="#FFF"/>
114         <Button
115             android:layout_width="wrap_content"
116             android:layout_height="wrap_content"
117             android:text="2"
118             android:textSize="20dp"
119             android:background="#999"
120             android:textColor="#FFF"/>
121         <Button
122             android:layout_width="wrap_content"
123             android:layout_height="wrap_content"
124             android:text="3"
125             android:textSize="20dp"
126             android:background="#999"
127             android:textColor="#FFF"/>
128 
129         <Button
130             android:layout_width="wrap_content"
131             android:layout_height="wrap_content"
132             android:text="÷"
133             android:textSize="20dp"
134             android:background="#990"
135             android:textColor="#FFF"
136             android:layout_column="3" />
137     </TableRow>
138     <TableRow>
139         <Button
140             android:layout_width="wrap_content"
141             android:layout_height="wrap_content"
142             android:text="0"
143             android:textSize="20dp"
144             android:background="#999"
145             android:textColor="#FFF"/>
146         <Button
147             android:layout_width="wrap_content"
148             android:layout_height="wrap_content"
149             android:text="00"
150             android:textSize="20dp"
151             android:background="#999"
152             android:textColor="#FFF"/>
153         <Button
154             android:layout_width="wrap_content"
155             android:layout_height="wrap_content"
156             android:text="."
157             android:textSize="20dp"
158             android:background="#999"
159             android:textColor="#FFF"/>
160         <Button
161             android:layout_width="wrap_content"
162             android:layout_height="wrap_content"
163             android:text="="
164             android:textSize="20dp"
165             android:background="#990"
166             android:textColor="#FFF"/>
167     </TableRow>
168 </TableLayout>

 

转载于:https://www.cnblogs.com/TENOKAWA/p/5409322.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 为设计一个Android Studio计算器界面,您可以遵循以下步骤: 1. 创建一个新的Android Studio项目并设置好基本信息。 2. 在Android Studio的设计视图中,使用布局编辑器来设计您的界面,您可以添加各种视图元素(例如文本框、按钮等)来创建一个具有良好用户体验的计算器。 3. 对于计算器按钮的排列,可以使用GridLayout或TableLayout进行布局。这些布局可以让您更好地控制您的按钮的位置和大小。 4. 添加适当的操作符按钮(例如加号、减号、乘号、除号等),并将它们与计算器的算术功能相关联。 5. 为计算器界面添加一些可定制化的选项,例如可以添加一个设置界面,允许用户更改主题或颜色方案等。 6. 添加一些适当的逻辑以实现计算器的基本功能,例如相加、相减、相乘和相除。 7. 最后,进行测试并进行必要的调整,以确保您的计算器在各种不同设备上都能够良好运行。 希望这些步骤能够帮助您设计一个美观、易用的Android Studio计算器界面。 ### 回答2: Android Studio是一款非常流行的Android开发工具,用于开发各种面向移动设备的应用程序。如果您正在尝试设计一个计算器应用程序,那么Android Studio是一个非常好的选择。 首先,设计一个好的计算器界面需要一些基本的布局技巧。在Android Studio中,您可以使用线性布局、相对布局和表格布局,以实现各种要求的UI设计。在这些布局中,线性布局是最常用的,它能够按照水平或垂直方向排列控件。相对布局允许在控件之间设置相对位置关系,而表格布局是用于创建网格状布局。 接下来,您需要选择合适的控件来制作计算器。在计算器中,最重要的控件就是数字键、运算符和结果文本框。Android Studio内置了许多标准的UI控件,如Button、TextView、EditText、Spinner等等,您可以选择这些控件来创建计算器界面。当然,您也可以使用自定义控件,比如实现可自定义颜色和大小的按键。 在设计计算器的外观时,颜色、字体和图片等元素都应该考虑,以满足应用程序的视觉需求。对于颜色和字体设计,可以使用Android Studio中自带的Material Design样式来简化过程,通过样式来确保应用程序的视觉一致性。对于图片,您可以选择一些专业的设计软件,比如Photoshop或Sketch,然后将它们导入到Android Studio中应用到相应的控件上。 最后,为了保持您的计算器应用的稳定性和良好的用户体验,您需要编写合适的Java代码,并使用Android Studio的模拟器或实际的设备对它进行测试。 总之,设计一个好的计算器应用程序需要对Android Studio的UI控件、布局、颜色、字体和代码编写等知识都有一定的掌握。只有在这些方面都有足够的技能,才能够顺利地实现一个质量高、功能齐全的计算器应用程序。 ### 回答3: 在设计Android Studio计算器界面时,需要考虑以下几个方面:布局、颜色、字体、按钮等UI元素。 1.布局 计算器的布局需要简洁明了,同时保持美观。可以采用线性布局或相对布局,也可以使用ConstraintLayout来实现。布局比较简单,仅需要一个显示区域和一些操作按钮。 2.颜色 颜色是视觉设计中非常重要的元素之一。可以考虑配合一些简单的灰色和白色背景来使计算器看起来非常简约。在颜色的选择上,可以参考Material Design的颜色规范,或者自定义一些颜色。 3.字体 计算器一般使用单调的数字,需要选择一个适合的字体以填充数字并文本化。Roboto是一个Virtual的sans-serif(无衬线体),在Google开发者平台上可用于数百家应用。另外可以尝试其他字体,如Open Sans、Lato等。 4.按钮 计算器主要的UI元素就是按钮了,可以使用Material Design风格的圆形按钮,并为其添加上合适的颜色,也可以采用矩形和正方形按钮。推荐使用TextView作为按钮,可以避免一些图形元素导致的渲染问题。 以上内容是Android Studio计算器界面设计时应该考虑到的几个方面。在设计时,需要基于用户习惯和日常操作场景的基础上进行优化。设计良好的计算器界面将大大简化用户操作,提升用户体验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值