Android初体验

[url=http://code.google.com/android/]Android[/url]是Google主导的开放式手机平台,它的应用是基于Java语言开发的,今天下载了它的SDK,体验了一把:

首先按照官方网站上的[url=http://code.google.com/android/intro/installing.html]安装SDK文档[/url]下载了Android SDK和Eclipse插件.

然后按照官方网站上的入门文档[url=http://code.google.com/android/intro/hello-android.html]Hello, Android![/url],开始写第一个Android应用

比较有意思的是,Android的界面布局除了Java API以外,还提供了基于XML的定义,在res/layout/main.xml文件里面写上这样的内容:


android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello, Android"
/>



然后在Java代码里面这样调用:

public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main); //插件自动生成常量定义
}

就可以显示出这样的界面:
[img]http://code.google.com/android/images/hello_world_5.png[/img]

上面的界面是SDK带的模拟器界面,它有很多启动参数和设置,比如模拟不同的分辨率、网络速度,具体的内容可以参考[url=http://code.google.com/android/reference/emulator.html]官方文档[/url]

Android的SDK还带了很多例子,也是非常好的学习资料,值得一看。

你可能感兴趣的:(Android)