Android开发学习入门之HelloWorld
Android开发学习入门之HelloWorld
真不知道自己写这些东西做什么,就说说Android开发学习入门之HelloWorld 。
1.AndroidManifest.xml
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.helloWorld"
- android:versionCode="1"
- android:versionName="1.0">
- <application android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:name=".HelloWorld"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- </manifest>
还有就是那了一个activity,应该类似一个窗口吧,名字是HelloWorld,前面的点有没有好像没有关系,我在学习的时候会注意下的。
下面android.intent.action.MAIN说明了这个窗口用作主窗口,android.intent.category.LAUNCHER是说把这个程序放入到程序列表里面。
2.string.xml
- <?xml version="1.0" encoding="utf-8"?>
- <resources>
- <string name="hello">Hello World, HelloWorld!</string>
- <string name="app_name">HelloWorld</string>
- </resources>
3.main.xml
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello"
- />
- </LinearLayout>
4.HelloWorld.java
- package com.android.helloWorld;
- import android.app.Activity;
- import android.os.Bundle;
- public class HelloWorld extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- }
- }
我想整个过程这样就都做完了,在这最简单的程序里也可能有理解不正确的地方。
断续学习吧!
评论暂时关闭