App of Engineering Framework

I just downloaded for Android studio, it is a frame structure

 Project Project structure:

             

             

.gradle : Gradle build system version specified by the wrapper

.idea : IDE files needed

the .app : development of all the code and resource files

        .build : module compiler output file app

        .libs : place the library file references

       .src : The main application file directory placement

               .androidTest : Unit testing directory

               .main : The main project directory and code

                         .java : Source Code Project

                          .res : Project Resource

                                 .drawable : storage of all kinds of bitmap files

                                 .values : storing all kinds of resource allocation, color, size, style, etc.

                                 .AndroidManfest.xml : a list of project files

Scripts .Gradle : Gradle compile the script

These are the general structure of Android studio

Based on this and then running a simple "Hello Word!" Project

MainActivity.java:

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

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

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Function on the parent object 1.MainActivity inherit AppCompatActivity, that is a main target of the first call

@Override Chinese meaning is rewritten in java which we inherited, we want to use must be rewritten. Overwrite the original oncreate approach, we help rewrite a oncreate, according to our ideas to implement this method.

2.antivity_main.xml TextView is similar to the inside javaweb html tags, for writing the program code for a display

3.MainActivity.java and activity_main.xml contact:

android phone system will only run java program, the program java code that you want to start a content view activity_main.xml file, this time will go activity_main.xml file is then converted into a wide variety of controls.

Display of the sample (Hello Word):

                            

Guess you like

Origin www.cnblogs.com/hhjing/p/12220993.html