在Eclipse新開專案
File>>New>>Project>>Android>>Android Project>>Next
填入Project Name, 選擇Bulid Target, 填入Application Name, package name(aaa.bbb),creat activity, Min SDK Vision(3)
打開SDK Manager
選擇Virtual Divices, 需要新增模擬的平台(AVD)
然後就可以參考網頁教學啦!!
- In the Eclipse Package Explorer, expand the
/res/layout/
folder and openmain.xml
(once opened, you might need to click the "main.xml" tab at the bottom of the window to see the XML source). Replace the contents with the following XML:<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>Save the file.
- Inside the
res/values/
folder, openstrings.xml
. This is where you should save all default text strings for your user interface. If you're using Eclipse, then ADT will have started you with two strings, hello and app_name. Revise hello to something else. Perhaps "Hello, Android! I am a string resource!" The entire file should now look like this:<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello, Android! I am a string resource!</string>
<string name="app_name">Hello, Android</string>
</resources> - Now open and modify your
HelloAndroid
class use the XML layout. Edit the file to look like this: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);
}
}
沒有留言:
張貼留言