Android HelloWord 编写方式介绍
2010-02-10 06:45:00 来源:WEB开发网核心提示:Java代码package com.layout; import android.app.Activity; import android.os.Bundle; public class ActivityFrameLayout extends Activity { @Override protect
Java代码
- package com.layout;
- import android.app.Activity;
- import android.os.Bundle;
- public class ActivityFrameLayout extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setTitle("哈哈");
- setContentView(R.layout.activityframelayout);
- }
- }
- package com.layout;
- import android.app.Activity;
- import android.os.Bundle;
- public class ActivityFrameLayout extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setTitle("哈哈");
- setContentView(R.layout.activityframelayout);
- }
- }
4.对AndroidManifest.xml进行配置,将新建Activity配置文件加进来
Android HelloWord的Java代码
- < ?xml version="1.0" encoding="utf-8"?>
- < manifest xmlns:android=
"http://schemas.android.com/apk/res/android"- package="com.layout"
- android:versionCode="1"
- android:versionName="1.0">
- < application android:icon="@drawable/icon"
android:label="@string/app_name">- < activity android:name=".Layout"
- 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=".ActivityFrameLayout"
android:label="activityFrameLayout">- < intent-filter>
- < action android:name="android.intent.action.MAIN" />
- < category android:name=
"android.intent.category.LAUNCHER" />- < /intent-filter>
- < /activity>
- < /application>
- < uses-sdk android:minSdkVersion="3" />
- < /manifest>
- < ?xml version="1.0" encoding="utf-8"?>
- < manifest xmlns:android=
"http://schemas.android.com/apk/res/android"- package="com.layout"
- android:versionCode="1"
- android:versionName="1.0">
- < application android:icon="@drawable/icon"
android:label="@string/app_name">- < activity android:name=".Layout"
- 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=".ActivityFrameLayout"
android:label="activityFrameLayout">- < intent-filter>
- < action android:name="android.intent.action.MAIN" />
- < category android:name=
"android.intent.category.LAUNCHER" />- < /intent-filter>
- < /activity>
- < /application>
- < uses-sdk android:minSdkVersion="3" />
- < /manifest>
5.Android HelloWord可以运行了,嘿嘿
[]
更多精彩
赞助商链接