首發

進入這個行業也這麼久了。之前在 別的網站上也更新過博客,可是一直都是斷斷續續,跟新了一點點,沒能堅持下去,也是常常會去看下別的寫的博客,可是都是做爲剽竊者。以爲嗎這樣有點很差意思,一直都是剽竊別的人,本身都不分享,就比如一直去拿別人的東西,可是本身歷來就不去拿東西給別人,我這樣的人是否是很小氣,因此我來證實我不是一個小氣的人,打算重新開始創建起本身的博客。在這裏但願本身可以堅持下去諾, 還有就是可以幫助到你們就是最好的, java

這裏就給你們奉送一個Android helloWord,相信你們都不須要我介紹了。 android



package com.example.helloword;

import android.os.Bundle;
import android.app.Activity;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

}
這裏在附送上界面佈局


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</LinearLayout>
這裏在附上AndroidMainifest.xml.這裏不少博客中間就會忘記附上權限對於剛開始接觸Android的人來講這簡直就是噩夢,應爲他不知道錯在哪裏,由於代碼原本就沒錯,可是就是不知道哪裏錯了。嘿嘿,



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.helloword"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.helloword.MainActivity"
            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>

Android還有一個比較容易忽視的就是project.properties這個文件,這裏其實就一直有一句話target = android-xx 這句話呢就是表示你當前編譯的版本,(而後還有新出Android studio這裏又有些不一樣,AS的話之後再更新吧,對於初學仍是建議使用ADT, java相關的配置環境和路徑我這裏就不會跟新了,相信你們本身去百度就能夠百度出來了)最後祝你們學習Android愉快。 app

相關文章
相關標籤/搜索