Chapter 2 create a project in andrid Studio
Chapter 2 create a project in andrid studio... 1
Introduction...
1
2.1 Hello world.1
2.2 andriod studio program structure analysis... 4
2.3 Edit Environment Settings... 4
2.4 AVD .. 4
2.5 Understand the application lifecycle... 4
2.6 FAQ...
4
Summary... 4
Chapter 2 create a project in andrid Studio
Innovation stems from dissatisfaction. ---------- Zhang hefu
Introduction
In the previous chapter, we mainly introduced the installation and environment settings of andriod studio. In this chapter, we will continue to learn about the new project of andriod studio. Starting from the "Hello World" project, we will gradually expand and learn about Project Creation, environment settings, breakpoint debugging, and AVD.
2.1 Hello World
Open the android development environment and create a project
2-1
The following page is displayed:
Enter the Project name: chaper_two
Other default values.
2-2
Click "Next" to display the following interface:
2_3
Click "Next" to display the following interface:
2-4
Click "Next" to display the following interface:
2-5
Click "finish". The project is created.
2.2 Android Studio Application Structure Analysis
Figure 2-6 shows the structure of the newly created "chapter_two" Application
2-6
1. the directory structure of Android studio represents a workspace. a workspace can contain a module, which can be understood as a project in eclipse;
2. in the directory, Java code and resource files (images, layout files, and so on) are all attributed to SRC. There is a main group under the src directory, and the Java and res groups are divided at the same time, res and eclipse have the same structure. Java is the source code package and class file;
3. different file creation methods. Right-click "new" or "command + N", and a new menu is displayed. The type of menu includes Java class, that is, general Java class. file is a common file, and package is the package creation, it is worth noting that android
Component, which directly provides the creation of basic components in Android.
2.3 Edit Environment Settings
2.3.1 topic settings
2-7
2.3.2 Chinese settings
2-8
2.3.3 Edit Environment Settings
2-9
This feature greatly improves development efficiency by writing and previewing layout files in real time.
2.3.5 real-time Preview
Open an activity_main.xml layout file and click the preview tab on the right to bring up the preview interface. You can select a mobile phone of many sizes for preview:
<Relativelayout 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: paddingleft = "@ dimen/activity_horizontal_margin"
Android: paddingright = "@ dimen/activity_horizontal_margin"
Android: paddingtop = "@ dimen/activity_vertical_margin"
Android: paddingbottom = "@ dimen/activity_vertical_margin"
Tools: context = ". mainactivity">
<Textview
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/hello_world"/>
</Relativelayout>
2-10
Writing and previewing layout files in real time can greatly improve development efficiency. You can also preview a variety of devices of different models and sizes at the same time, and write code to adapt to multiple models at the same time, now it is a reality.
(To be continued)
2.4 AVD
2.5 Understand the application Lifecycle
2.6 FAQs
Summary
Previous chapter
Http://blog.csdn.net/zhanghefu/article/details/9286123
Next chapter