1. Files and folders for Android apps
In an Android engineering organization, the most frequently edited folders are:
- src - Java source files related to your project, which includes the activity files of the "controller", including your models and helpers. (Translator Note: This involves our commonly used MVC pattern, in Android, the view is mainly viewed by view, and the activity is mainly the logical control layer, and some specific classes, which is what we call model, Helper this is mainly used in the database aspect)
- Res - the resource file associated with your project. All images, strings, layout files, and other resource files stored in the hierarchy of resource files in the Res directory
- Res/layout - an XML layout file that describes the views and layouts for each activity and detail view ( such as list items ).
- res/values - an XML file that holds the values of the individual quantity attributes, including: String.xml, DIMENS.XM, Styles.xml, Colors.xml, Themes.xml, and so on. (Translator Note: String.xml is the file that holds the string resource, Dimens.xml is the resource file for the length, followed by the style, color, and theme of the resource file)
- res/drawable - Here we store the various density-independent images that are used in our application. (Translator Note: Can put image files, can also store selector and other XML layout image, mainly used in the button state change is the change of the picture)
- res/drawable-hdpi - defines a series of files for each resolution that are specific to the image being used. (Translator Note: The Res folder is mainly drawable-hdpi/mdpi/ldpi three folders, they correspond to different screen resolution, h,m,l are high, medium, low three English words, respectively, the screen resolution is roughly 480* 854,320*480,240*320, but with the growing Android phone screen, there is also a drawable-xhdpi/xxhdpi folder, which is used to store different screen sizes, such as 960*720,1280*720, to display the image resources.
The most frequently edited files are:
AndroidManifest.xml- 这是android应用定义文件,它包含有关android应用的信息,比如android的最小版本,访问android设备功能的权限,比如网络访问权限,使用电话的权限等。(译者注:这个文件是android工程一个很重要的文件,所有Activity,Service的声明,广播接受,对每个Activity的控制,比如全屏,锁定方向和定义它加载的模式)
res/layout/activity_foo.xml -这个文件是描述activity界面的布局文件,这意味着在一个应用屏幕中每个视图对象的放置。(译者注:这个里面主要是用xml文件写的某个布局)
src/.../FooActivity.java - "控制器"Activity使用视图来构造它,处理所有的事件分发,和对一个应用屏幕的视图逻辑。(这里面放的是程序的逻辑控制,也就是我们所说的java源文件,处理点击事件,逻辑处理等都在这些文件中)
Other files that are rarely edited include:
- Gen - generated Java code files that are only used internally by Android. (Translator Note: This place's files are automatically generated by Eclipse, do not change)
- Assets - for compiled source files that are associated with your project, it is seldom used. (Translator Note: This place can put some resources, if we use a third-party SHARESDK will be found here is often used, there are some functions, such as storing another apk, and then in our application, now the APK is copied to the SD card, You can then install the app, which I used in order to use root for the user .
- bin - Once the application is created, it is stored with the application package files that are eventually generated with your project. (Translator Note: Some files will be generated here, in general, when we are debugging, Eclipse will generate a package that ends with an. APK, which is the package installed on your real machine and on the simulator)
- Libs - contains some libraries (jars) that you might want to link to your app. (Translator Note: There are some egg pain here, in fact, we often say that the third-party library, is not the system comes with, others write library. )
Reference Documents:
- Http://developer.android.com/tools/projects/index.html#ApplicationProjects
- Http://www.codeproject.com/Articles/395614/Basic-structure-of-an-Android-project
- Http://mobile.tutsplus.com/tutorials/android/android-sdk-app-structure/
the first translation of foreign tutorials, finally the first translation is done, there is a little egg pain, no matter good and bad, at least translated, some places with my usual work in the understanding of that place, there is a wrong place to ask you to criticize. Thank you.
Explore the basic Android engineering directory structure for application development