华东交通大学理工学院毕业设计
3.2搭建Android开发环境
任何项目的运行都要有它的环境,Android也有自己的运行环境。 第一步:安装java虚拟机un-java6-jdk版本。 操作系统:win7旗舰版或linux 软件包:sdk,atd。
运行环境:eclipse-SDK-3.6.2集成Android开发工具版-win32
第二步:安装Eclipse3.5工具 官网http://www.eclipse.org/downloads/ 选择版本(图4.2):进行安装
图 3.2
第三步:安装Android SDK:首先要下载SDK,可以在这个网址下载Http://developer.android.com/sdk ,选择相应的系统进行安装
第四步:安装Android ADT插件
运行Eclipse,选择help->install new software 选择add,将会弹出一个框
李发万:基于Andriod的音乐播放器设计与实现
图 3.3
点击OK,选择要安装的软件,占next,然后选择接受协议,直到安装成功,重启Eclipse软件,设置Android SDK Home,Window->refrence
图 3.4
在SDK location中输入SDK Tools路径:D:\\android software\\android-sdk-windows 点击OK
这样Android环境就已经搭建成功了。
21
华东交通大学理工学院毕业设计
第四章 播放器系统功能详细设计
4.1音乐播放器主界面功能实现
4.1.1 播放器主界面
播放器主界面(图5.1)
图 4.1
Android的每一个可视化界面,都有其的唯一的布局配置文件,该文件里面有各种布局方式,和各种资源文件如图像,文字,颜色的引用,程序在运行时,可以通过代码对各配置文件进行读取。这样就可以形成不同的可视化界面和炫丽的效果。
李发万:基于Andriod的音乐播放器设计与实现
Context.setContentView(layoutResID),参数为资源ID,该Id在工程目录res/layout下,主界面布局文件名为main。
下面为main.xml布局文件代码结构如下:
xmlns:android=\ android:layout_width=\ android:layout_height=\> android:background=\ android:layout_height=\> android:layout_height=\ android:layout_width=\ android:layout_marginTop=\ android:layout_height=\ android:background=\ /> android:layout_width=\ android:layout_marginTop=\ android:layout_height=\ android:layout_width=\ android:background=\> android:src=\ android:layout_height=\> android:layout_width=\ android:layout_marginLeft=\ /> android:layout_width=\ android:layout_marginLeft=\ /> android:layout_height=\ android:layout_height=\ android:text=\状态:\ 23 华东交通大学理工学院毕业设计 /> android:layout_marginTop=\ android:textColor=\ /> android:layout_marginLeft=\ android:layout_height=\ android:text=\停止\ android:layout_marginTop=\ android:textColor=\ android:layout_width=\ android:layout_width=\ android:layout_height=\ android:layout_marginLeft=\ android:paddingTop=\ android:src=\ /> android:orientation=\ android:layout_marginTop=\> android:id=\ android:layout_width=\ android:layout_height=\ android:layout_marginLeft=\ android:paddingLeft=\ android:paddingTop=\ android:progressDrawable=\ android:thumb=\ /> android:layout_height=\ android:layout_height=\ android:layout_width=\ android:layout_marginLeft=\ />