android開發helloWorld工程

解決在andriod Studio裏面無法打開視圖設計器

在Gradle Scripts下面的gradle-wrapper.properties中distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip修改爲distributionUrl=http://services.gradle.org/distributions/gradle-4.4-all.zip

創建虛擬設備

這裏寫圖片描述

源代碼目錄

源代碼目錄存放的是java的源碼,邏輯處理部分
這裏寫圖片描述

圖片存放目錄

這裏寫圖片描述

清單文件

這裏寫圖片描述

配置應用程序的版本號版本名字

  1. 修改Gradle Scripts目錄下修改build.gradle文件
    這裏寫圖片描述
  2. 修改該文件裏面的versionName字段。
    這裏寫圖片描述
  3. 在手機設置裏面查看應用程序信息可以看到版本信息。
    這裏寫圖片描述

Application標籤

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.administrator.helloworld" 包文件路徑
    android:versionCode="1"
    android:versionName="我的第一個程序">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher" 應用程序圖標
        android:label="@string/app_name" 應用程序標題
        android:roundIcon="@mipmap/ic_launcher_round" 應用程序圓角圖標
        android:supportsRtl="true"
        android:theme="@style/AppTheme"> 應用程序主題
        <activity android:name=".helloworld"> java源文件代碼
            <intent-filter>
                <action android:name="android.intent.action.MAIN" /> 這裏聲明activity的主入口 第一次被啓動的

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

activity源代碼

package com.example.administrator.helloworld;

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

public class helloworld extends Activity {
/*
*當activity第一次啓動的時候就會調用onCreate函數
*/
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
/*
*從一個layout資源中設置activity的內容
*/
        setContentView(R.layout.activity_helloworld);
    }
}

資源跳轉

按住ctrl點擊資源就可以跳到相應的資源界面。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章