薂肀葿羅android计算器设计节膂薇莅肃本人学习android有一个多月了,在学习期间为了对所学的知识进行应用,因而设计了一个简单的计算器,现在通过本文与大家一起分享。罿由于本人水平有限,因此设计的计算器可能有着一部分的BUG,如发现BUG请联系我,谢谢!衿 螄螃QQ:,我们都要设计一个图标,可以说图标是应用程序的名片,好的图标能够很快地吸引用户。葿关于如何设计图标,在网上可以查询相关文件进行学习,在这不多做讲述,本人在网上寻找了一个图标作为计算器应用的图标,图标如下所示。莆肄由于不同的android手机有着不同的分辨率,将不同分辨率的图标图片放置在相应位置,如下图所示。袀薇drawable-hdpi中放置分辨率最高的图标,drawable-ldpi中放置分辨率中等的图标,drawable-hdpi中放置分辨率最低的图标。螆图标图片大小的要求如下:,修改情况如下:罿<applicationandroid:icon="***@drawable/calculator"android:label="***@string/app_name">膅其他设置保持不变。,代码为:蝿<stringname="app_name">计算器</string。肈结果如下图所示:蚄羁按钮放置以及界面编排袁界面设计应该尽量简洁而美观,应该具有良好的交互性。因本人水平有限,所以设计的界面不是很完美,望请见谅。膆最终设计的计算器界面情况如下所示:肄螂整个界面的布局为LinearLayout,按钮的布局为TableLayout。另外需要对EditText和Button的一些属性进行相关设置,以使得它们满足我们的需要。,代码如下所示:薈<?xmlversion=""encoding="utf-8"?>蒃<LinearLayoutxmlns:android="http://schemas./apk/res/android"蒂android:orientation="vertical"虿android:layout_width="fill_parent"蚇android:layout_height="fill_parent"膇android:background="#880000"芃android:paddingTop="50px"螁>聿<EditText薆 android:id="@+id/editText"羃 android:gravity="left"薈 android:text=""膈 android:textSize="37px"肅 android:layout_height="150px"螃 android:layout_width="fill_parent"蕿 android:layout_marginBottom="20px"芆 android:layout_marginLeft="10px"蒅 android:layout_marginRight="10px"蒄 android:editable="false"蚁 android:cursorVisible="false" 蚈 ></EditText>袄<EditText膄 android:id="@+id/editText1"蒈 android:gravity="left"螇 android:text=""莃 android:textSize="40px"羄 android:layout_height="80px"蒀 android:layout_width="fill_parent"腿 android:layout_marginBottom="30px"羇 android:layout_marginLeft="10px"蒁 android:layout_marginRight="10px"薁 android:editable="false"芇 android:cursorVisible="false"蒆 android:focusable="false"膁 ></EditText>莈 <TableLayout莆 android:layout_width="fill_parent"袆 android:layout_height="fill_parent"袂 android:stretchColumns="0,1,2,3,4"蒀 >螈<TableRow>芅<Button蚂 android:id="@+id/buttom7"蒁 android:layout_margin="
android计算器研发设计 来自淘豆网m.daumloan.com转载请标明出处.