Android实训报告.docx
《Android实训报告.docx》由会员分享,可在线阅读,更多相关《Android实训报告.docx(22页珍藏版)》请在冰豆网上搜索。
Android实训报告
Android实训报告
学院:
******
班级:
******
学号:
******
姓名:
******
一、实训背景及目的要求
1.1背景简介
Android(读音:
['ændrɔid])是一种以Linux为基础的开放源码操作系统,主要使用于便携设备,目前尚未有统一中文名称,中国大陆地区较多人使用安卓或安致.Android操作系统最初由AndyRubin创办[5],最初只支持手机.2005年由Google收购注资,并拉拢多家制造商组成开放手机联盟(OpenHandsetAlliance)开发改良,逐渐扩展到到平板电脑及其他领域上[6].2010年末数据显示,仅正式推出两年的操作系统的Android已经超越称霸十年的诺基亚Symbian系统,跃居全球最受欢迎的智慧手机平台.采用Android系统手机厂商包括HTC、Samsung、Motorola、Lenovo、LG、SonyEricsson等.
1.2实训目的及要求
Android以Linux为核心的Android行动平台,使用Java作为编程语言。
本实训是在学习java语言程序设计的基础上进行的一次综合实践。
通过综合训练,要求学生掌握java语言程序设计的基本技能和Android编程的应用,并较系统地掌握JAVA语言程序设计开发方法以及帮助文件的使用等,使学生通过本次实训,能够进行独立的Android应用程序开发,能够在实际操作中得到进一步的提高,为以后的学习和工作打下良好的基础。
目的:
1、培养学生运用所学课程Java语言程序设计的理论知识和技能,分析解决计算机实际应用中的问题的能力。
2、培养学生在Java语言程序设计的基础上,开发Android应用程序的思想和方法.
3、培养学生调查研究、查阅技术文献、资料、手册以及编写技术文献的能力。
通过课程设计,要求学生在指导教师的指导下,独立完成课程设计的全部内容,包括:
1、确定开发的程序,收集和调查有关技术资料.
2、按软件工程步骤进行程序设计.
3、对完成的程序进行测试和完善.
4、完成课程设计报告。
二、设计思路
2。
1设计题目
以Android系统的UI界面开发为基础,设计一个可以简单计算标准体重的应用程序,要求以2个Acitivity实现,第一个Activity作为输入界面,第二个Activity作为结果输出界面,具体实现细节自行设计。
2.2功能分析
该设计题目要求实现可计算输出标准体重功能的应用程序。
通过查阅资料可知,按照世界卫生组织推荐的计算标准体重的方法,需要获知的输入信息有性别、身高.故可在第一屏设置有单选框以确定性别,输入框以获取身高.另,为了增加程序的实用性,可再设一可选输入框,用来得到实际体重,与标准体重对比,给出用户一些健康提议。
第二屏设置有结果输出显示区域与健康提示显示区域.
2.3模块划分
通过程序功能分析,可将程序划分为2个模块,即2个Activity:
第一个Activity:
两个单选框(RadioButton)获取性别,一个输入框(EditText)获取身高,一个可选输入框(EditText)获取实际体重,一个按钮(Button)及一些提示文本。
第二个Activity:
一个文本显示区(TextViw)显示计算结果,一个可选文本显示区(TextView)显示提示信息。
三、设计实现及代码分析
3.1第一个Activity
3。
1。
1布局文件:
main。
xml:
采用绝对布局,以实现控件精准显示;
RadioGroup包含两个RadioButton,以实现性别男女选择;
两个供输入的EditText限定了输入类型为numberDecimal,以确保只接收数字型数据。
main.xml完整代码如下:
〈?
xmlversion=”1。
0"encoding="utf-8"?
〉
android="http:
//schemas。
android。
com/apk/res/android"
android:
orientation=”vertical"
android:
layout_width=”fill_parent"
android:
layout_height="fill_parent”
〉
〈TextView
android:
id=”@+id/tv1”
android:
layout_width=”wrap_content"
android:
layout_height="wrap_content"
android:
text="@string/tv1_t"
android:
textSize=”20sp”
android:
layout_x=”50px"
android:
layout_y="25px"
/>
android:
layout_width=”wrap_content”
android:
layout_height=”wrap_content"
android:
text=”@string/tv_sex”
android:
layout_x=”50px"
android:
layout_y="100px”
/〉
〈TextView
android:
layout_width="wrap_content"
android:
layout_height=”wrap_content"
android:
text="@string/tv_tall"
android:
layout_x="50px"
android:
layout_y=”150px"
/〉
android:
id="@+id/rg”
android:
layout_width=”wrap_content”
android:
layout_height="wrap_content"
android:
orientation=”horizontal”
android:
layout_x=”95px"
android:
layout_y="90px”
〉
〈RadioButton
android:
id=”@+id/rb_male”
android:
layout_width=”wrap_content”
android:
layout_height="wrap_content"
android:
text=”@string/male"
/>
〈RadioButton
android:
id="@+id/rb_female"
android:
layout_width=”wrap_content”
android:
layout_height="wrap_content”
android:
text="@string/female"
/〉
〈/RadioGroup〉
android:
id=”@+id/et_tall”
android:
layout_width=”100px”
android:
layout_height=”40px”
android:
layout_x=”100px”
android:
layout_y="140px”
android:
inputType="numberDecimal”
/〉
android:
layout_width="wrap_content”
android:
layout_height="wrap_content”
android:
layout_x=”200px"
android:
layout_y="145px"
android:
textSize=”20sp"
android:
text=”cm”
/>
android:
layout_width="wrap_content"
android:
layout_height="wrap_content”
android:
layout_x="50px”
android:
layout_y="200px”
android:
text="@string/tv_real”
/>
〈EditText
android:
id="@+id/et_real"
android:
layout_width="100px"
android:
layout_height="40px"
android:
layout_x="100px"
android:
layout_y=”230px”
android:
inputType=”numberDecimal"
/〉
android:
layout_width=”wrap_content”
android:
layout_height="wrap_content"
android:
layout_x="200px”
android:
layout_y="235px"
android:
textSize="20sp”
android:
text="kg”
/〉