Android development (4) -- the structure of a simple program

To understand program development, first understand the program structure and function. Let me introduce the function of a code block in a simple HelloWorld.

     

[1] package is the package name, and each java file has a package name. When other files are referenced, just import the corresponding package name.

[2] import classes of other modules, the last field of the import line is the class name, and the front is the package name and sub-package name

[3] The definition of the class, extends means that this class inherits from AppCompatActivity, if there is still a corresponding interface to implement, you need to use implements

[4] End of class

[5] method, protected means that this method can be rewritten in subclasses, and onCreate is a method that is executed when an Activity starts to run.

[6] End of method

【7】【8】Several other methods

[9] A complete module code

Then look at the Layout file

[1] Layout method ConstraintLayout is a constraint layout

   Commonly used layout methods in Android are

1.  ConstraintLayout ConstraintLayout

2. LinearLayout LinearLayout

3. Relative layout RelativeLayout

4. Table layout TableLayout

5. Frame layout FrameLayout

6. AbsoluteLayout absolute layout

The property setting of TextView at the beginning of [3] under the Layout property

Guess you like

Origin blog.csdn.net/chanimei_11/article/details/124518512