WEB开发网
开发学院手机开发Android 开发 Android 开发环境的构建方法总结 阅读

Android 开发环境的构建方法总结

 2010-03-26 15:58:00 来源:WEB开发网   
核心提示:1.5 platform. These don’t have to match; Android applications are forward-compatible, so an application built against the 1.1 platform library will run normally
1.5 platform. These don’t have to match; Android applications are forward-compatible, so an application built against the 1.1 platform library will run normally on the 1.5 platform. The reverse is not true.

Your Android project is now ready. It should be visible in the Package Explorer on the left. Open the HelloAndroid.java file, located inside HelloAndroid > src > com.example.helloandroid).

It should look like this:

下面是点完Finish按钮之后自动生成的代码:

view plaincopy to clipboardprint?

package com.example.helloandroid;

import android.app.Activity;

import android.os.Bundle;

public class HelloAndroid extends Activity {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

}

}

package com.example.helloandroid;

import android.app.Activity;

import android.os.Bundle;

public class HelloAndroid extends Activity {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

}

}

Notice that the class is based on the Activity class. An Activity is a single application entity that is used to perform actions. An application may have many separate activities, but the user interacts with them one at a time. The onCreate() method will be called by the Android system when your Activity starts — it is where you should perform all initialization and UI setup. An activity is not required to have a user interface, but usually will.

Now let’s modify some code!

构建 UI

Take a look at the revised code below and then make the same changes to

上一页  1 2 3 4 5 6 7 8  下一页

Tags:Android 开发 环境

编辑录入:coldstar [复制链接] [打 印]
赞助商链接