锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 鍦↙inearLayout澶栭潰鍖呬竴灞係crollView鍗沖彲錛屽涓嬩唬鐮?/p>
Apidemo 涓叧浜庡浣曚嬌鐢⊿crollView璇存槑錛岃鍙傝冿細 java浠g爜 鍔犲湪button鍝噷鍚屾椂鍦ˋndroidManifest.xml 鍝噷鍔犱笂涓鍙ヨ瘽錛屾斁鍦ㄧ涓涓猘ctivity 鐨勪笅闈?/p>
xml錛氫唬鐮侊細 <activity android:name="BCD" android:label="@string/bcd_title"></activity> <?xml version="1.0" encoding="utf-8"?> </application> </manifest> 璺寵漿浠g爜錛?/p>
private void setListensers() {
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:id="@+id/layout"
android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_text_1"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_button_1"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_text_6"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_button_6"/>
</LinearLayout>
</ScrollView>
2錛氶〉闈㈣煩杞殑瀹炵幇錛堜笉鍚宎ctivity闂寸殑鍒囨崲錛?/p>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="com.demo.android.AutoGnosis">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".AutoGnosis"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="BCD" android:label="@string/bcd_title"></activity> //娣誨姞鏍囩灞炴т笌values/report.xml瀵瑰簲
<uses-sdk android:minSdkVersion="3" />
Log.d(TAG,"set Listensers");
button_next.setOnClickListener(bt_next);
}
private Button.OnClickListener bt_next = new Button.OnClickListener(){
public void onClick(View v){
//switch to BDC page璺寵漿鍒癇DC.class
Intent intent = new Intent();
intent.setClass(AutoGnosis.this, BCD.class);
startActivity(intent);
Intent intent = new Intent();
intent.setClass(Bmi.this, Report.class);
Bundle bundle = new Bundle(); //bundle甯﹀弬鏁拌煩杞?br />
bundle.putString("KEY_HEIGHT",field_height.getText().toString());
bundle.putString("KEY_WEIGHT",field_weight.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
}
};
]]>
榪欐牱鐨勯敊璇紝鏁翠簡鍗婂ぉ緇堜簬鎵懼埌瑙e喅鏂規(guī)硶銆傛垜鐢ㄧ殑鏄疺ista錛岃屾垜鍙堝枩嬈㈠皢鎵鏈夊彲浠ヨ緗殑鐢ㄦ埛鏂囦歡鐨勪綅緗敼鑷矲鐩樹笅銆傝繖鏍峰湪鐢‥clipse鎴栬呬粠鍛戒護琛屽垱寤篈ndroid Emulator鏃訛紝鐩稿簲鐨勬枃浠舵槸琚斁緗埌 “F:\Users\<username>\.android“ 涓嬮潰浜嗭紝鑰岀▼搴忚繍琛屾椂浠嶇劧浠?“C:\Users\<username>\.android“ 涓嬫煡鎵劇浉搴旂殑閰嶇疆鏂囦歡錛屼粠鑰屽鑷翠笂闈㈢殑閿欒銆?/p>
濂藉惂錛屽張google浜嗕笅錛屾壘鍒版柟娉曞涓嬶細
鏂規(guī)涓錛?
鎶?"F:\Users\<username>\.android“ 涓嬬殑鏂囦歡澶嶅埗鍒?“C:\Users\<username>\.android“ 涓嬮潰鍗沖彲瑙e喅榪欎釜闂錛屼笉榪囪繖鏍風殑瑙e喅鏂規(guī)鏈変竴涓槑鏄劇殑緙虹偣錛岄偅灝辨槸濡傛灉鍙堟柊
寤虹珛AVD錛屽張寰楅噸鏂板鍒躲傛劅瑙夊緢楹葷儲~~~
鏂規(guī)浜岋細
鎵撳紑緋葷粺灞炴?->鐜鍙橀噺鈥?gt;鍦?#8220;緋葷粺鍙橀噺”閭d竴涓狦roupBox涓嬮潰閫夋嫨“鏂板緩”-->鍙橀噺鍚嶄負 "ANDROID_SDK_HOME” (娉ㄦ剰錛岃繖涓彉閲忓悕涓嶈兘鏀瑰彉錛屽彧鑳芥槸榪欎釜鍚嶅瓧錛?錛岀劧鍚?/p>
鎶婂彉閲忓兼敼涓轟綘鎯蟲妸AVD鎵鍦ㄧ殑".android”鏂囦歡澶規(guī)斁緗殑浣嶇疆錛屾瘮濡傦細"F:\AndroidEmulator”錛屽湪榪欓噷鎴戞妸瀹冩斁鍦ˋndroid SDK鍖呬腑錛屽間負錛?D:\SDK\Android\android-sdk- windows-1.5_r3”,濡備笅鍥炬墍紺恒?褰撶劧 涔熷彲浠ユ洿鏀規(guī)垚鍏跺畠 鐨勮礬寰?nbsp;
璁懼畾鎴愬姛鐨勮瘽 錛屽湪eclipse閲宲referneces -> Android -> Bulid Setting閲屼負濡備笅緇撴灉錛欴efault debug keystore: F:\Android_Emulator\\.android\debug.keystore
鐒跺悗榪欐牱灝卞彲浠ヤ竴鍔蟲案閫鎬簡錛侊紒錛?/p>
鐒跺悗鎴戝氨鏂板緩浜嗕竴涓狝ndroid宸ョ▼錛屽紑濮嬩簡Hello World涔嬫梾~~~鍙鍦ㄦ枃浠朵腑娣誨姞涓夎浠g爜錛屽涓嬫墍紺猴細
1: TextView tv = new TextView(this); 2: tv.setText("Hello World!!!"); 3: setContentView(tv); 鐒跺悗灝辮繍琛岋紝緇撴灉濡備笅錛?/p>
鍝堝搱錛?Hello World!!!”榪欏彞璇濇灉鐒舵槸浠g爜鐣岀殑緇忓吀鍟婏紒錛侊紒鎺ヤ笅鏉ュ氨鍙戜簺鍦ˋVD涓婄殑涓浜汚ndroid浣撻獙鍥懼惂錛屼竴騫翠箣鍐呮垜涓瀹氳緇欒嚜宸辨崲涓閮ˋndroid鎵嬫満錛侊紒錛?/p>
鏈枃鏉ヨ嚜CSDN鍗氬錛岃漿杞借鏍囨槑鍑哄錛歨ttp://blog.csdn.net/ghd2000/archive/2010/06/10/5661813.aspx