Android实验设计文档格式.docx

上传人:b****3 文档编号:15882677 上传时间:2022-11-16 格式:DOCX 页数:22 大小:592.99KB
下载 相关 举报
Android实验设计文档格式.docx_第1页
第1页 / 共22页
Android实验设计文档格式.docx_第2页
第2页 / 共22页
Android实验设计文档格式.docx_第3页
第3页 / 共22页
Android实验设计文档格式.docx_第4页
第4页 / 共22页
Android实验设计文档格式.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

Android实验设计文档格式.docx

《Android实验设计文档格式.docx》由会员分享,可在线阅读,更多相关《Android实验设计文档格式.docx(22页珍藏版)》请在冰豆网上搜索。

Android实验设计文档格式.docx

5、安装手机USB驱动

如果用模拟器调试,则可暂时不装。

6、建立新项目,实现HelloWorld。

OpenEclipse.

ClickthemenuFile->

New->

Project.

ExpandtheAndroidfolderandselectAndroidProject.

NametheprojectHelloWorld

得到的文件结构如下:

运行:

选运行的设备,可以是模拟器,也可以是真机(如果已经连接好真实手机的话):

 

模拟器运行:

真实手机调试:

实验二:

界面设计:

控件与布局

Android编程基础,UI设计。

1、了解Android编程原理

2、掌握界面控件设计

3、掌握控件的事件处理编程

UI设计原理

1、了解各种控件的基本功能

各种控件:

Menu

TextView、EditText、

Button

Radiobutton

List

ProgressBar;

2、了解布局Layout的应用

多种Layout:

AbsoluteLayout

FrameLayout

GridView

LinearLayout

ListLayout

RadioGroup

TableLayout

………

3、利用布局安排各种控件,设计良好用户界面

<

LinearLayoutxmlns:

android="

android:

orientation="

vertical"

layout_width="

fill_parent"

layout_height="

>

TextViewandroid:

id="

@+id/TextView01"

wrap_content"

text="

@string/hello"

/>

EditTextandroid:

@+id/EditText01"

ImageViewandroid:

@+id/ImageView01"

src="

@drawable/adr"

LinearLayoutandroid:

@+id/LinearLayout01"

horizontal"

>

Buttonandroid:

@+id/Button01"

@string/btn_name"

@+id/Button02"

@string/stp_name"

/LinearLayout>

ProgressBarandroid:

@+id/progressbar01"

20px"

style="

?

android:

attr/progressBarStyleHorizontal"

SeekBarandroid:

@+id/seekbar01"

实验三:

图形绘制与OpenGL

在屏幕绘制各种图形,了解OpenGL

1、了解在屏幕绘图方法

2、了解OpenGL

1、绘制直线、园、曲线等各种图形

2、显示字符

3、利用OpenGL编程方法

publicvoidonDrawFrame(GL10gl){

//一般的opengl程序,首先要做的就是清屏

gl.glClear(GL10.GL_COLOR_BUFFER_BIT|GL10.GL_DEPTH_BUFFER_BIT);

//紧接着设置模型视图矩阵

gl.glMatrixMode(GL10.GL_MODELVIEW);

gl.glLoadIdentity();

//清空矩阵

GLU.gluLookAt(gl,0,0,3,0,0,0,0,1,0);

//视点变换,将相机位置设置为(0,0,3),同时指向(0,0,0)点

//设置模型位置旋转及缩放信息

gl.glTranslatef(0.0f,0.0f,-1.0f);

//将模型位置设置为(0,0,-1)

floatangle=30.0f;

gl.glRotatef(angle,0,1,0);

//绕模型自身Y轴旋转30度

gl.glRotatef(angle,1,0,0);

//绕模型自身X轴旋转30度

gl.glScalef(1.2f,1.2f,1.2f);

//设置三方向的缩放系数

//设置颜色

gl.glColor4f(0.0f,0.0f,0.0f,1.0f);

//渲染立方体

mCube.draw(gl,gl.GL_TRIANGLES);

//mCube.draw(gl,gl.GL_LINES);

}

   

实验四:

网络访问与服务

掌握Android网络访问方法

1、了解手机WEB网站访问编程

2、通过网络进行数据访问

3、了解数据库使用

利用Android网络访问协议

1、访问WEB网站,通过HttpResponse类,读入网络数据。

HttpClientclient=newDefaultHttpClient();

HttpGetget=newHttpGet(url);

HttpResponseresponse=client.execute(get);

HttpEntityentity=response.getEntity();

//尝试读取entity的长度,返回-1表示长度未知

longlength=entity.getContentLength();

InputStreamis=entity.getContent();

Strings=null;

if(is!

=null){

ByteArrayOutputStreambaos=newByteArrayOutputStream();

byte[]buf=newbyte[512];

intch=-1;

intcount=0;

while((ch=is.read(buf))!

=-1){

baos.write(buf,0,ch);

count+=ch;

//如果长度已知,可以通过taskProgress()通知监听者任务执行的比例

if(length>

0){

listener.taskProgress(this,count,length);

}

//为了更好的演示进度,让线程休眠100ms

Thread.sleep(100);

}

Log.e("

HttpTask"

"

length="

+baos.toByteArray().length);

//返回内容

s=newString(baos.toByteArray());

}

returns;

读入网站数据:

实验五:

硬件访问与传感器

通过底层API访问手机硬件及手机上的各种传感器

1、获取手机上电话、短信等各种功能的编程

2、了解手机上各种传感器的功能与使用方法

利用手机本身的功能与相关传感器的使用

1、了解程序使用手机电话功能的方法

短信收发:

packagecom.android.TinySMS;

importandroid.app.Activity;

importandroid.app.PendingIntent;

importandroid.content.BroadcastReceiver;

importandroid.content.Context;

importandroid.content.Intent;

importandroid.os.Bundle;

importandroid.telephony.gsm.SmsManager;

i

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 公共行政管理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1