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点击资源就可以跳到相应的资源界面。

猜你喜欢

转载自blog.csdn.net/kebiaoy/article/details/80979154