The Android studio project structure primarily introduces the following several folders, followed by additional
(1) Introduction to Java folders
(2) Res folder introduction
(3) Introduction of R file
(4) Introduction of manifests Folder
Let's take a look at the entire project structure
(1) Introduction to Java folders
Java folder is mainly stored in the source code, there is no good to talk about, mainly in the development process under this folder how we plan our code, first of all, how do I dig a hole bury their own bar, last August bar, then just out, dictionary, And another intern directly embarked on the development of business trip Bao Project, at the beginning of the normal track forward, to the end of the pursuit of re-use code, but also worry about later maintenance problems, but there is no experience, is you do, At the end of the day, we were so desperate. The contents of the original five or six activities are all assembled into an activity, the layout page is also fully centralized into an XML file, the dynamic judgment of the load that, anyway, the last is a project with an activity, an XML implementation, This year past, now I just hear the leadership said maintenance business, where needs to change, I began to tremble, MD, these dozens of if else if else I have to debug a line of code to go again, it is important that the code has not been added to the habit of remarks, it is a day dog, Anyway, the code is not good maintenance is not good to expand, just a word, hundred no virgin. All right, back to the chase. This has been working for a year, talk about how to plan our code, I think to take over a new project, we first have to give him a module, not to consider the two pages similar to the original, the two pages of the logical code, I put it two to the whole piece, this is not correct, We should divide the package according to the function module, instead of the package according to the level, for example, a project mainly has two function modules, one is about the hair recommendation, one is about the clothes collocation, even if the two have more pages of the same, we will be divided into two pieces, a Hairstyle, another piece of clothes, later if you want to reuse some code, we can subclass the parent class to implement.
(2) Res folder introduction
Res folder mainly contains some resource files, such as pictures, audio files, and even database files, etc. can be initialized mainly have drawable,layout,menu,mipmap,values several folders
drawable and Mipmap: The two are mostly storage graphics resources, before in eclipse there is no mipmap this folder, instead of using studio as a development tool, the first is really a circle, Simply put all the custom XML graphics resource files thrown in the drawable, the graphic resources of the artist Transduction Miamap, and later checked the information, this is not correct, although the two in use is no difference, and the use of MIPMAP system will provide a certain performance optimization on the scale , but we should only put the Application Launcher icon in the Mipmap folder, the other should be thrown in the drawable, specific people can Baidu a lot, here is no longer detailed.
layout:layout folder mainly contains user interface resource files, file type is XML.
Menu : main file
Values/dimens: mainly defines some dimension values
values/strings: mainly defines some strings
values/styles: main definition style
We can also define some files, such as colors (color resource file), arrays (array resource file) under the Values folder, so as to facilitate our management
(3) Introduction to the R folder
The use of resource files is divided into code that is used in the resource file and referenced in other resource files. When we compile an Android app, Android automatically generates an R class that generates the corresponding inner class based on different resource types, which contains the identifiers of all the resource files used in the system.
(4) Introduction of Manifest folder
There is a file in the manifest folder
The project structure of Android training preparation materials