Directory Structure of Android project

Source: Internet
Author: User


1. To maximize the separation of files and code that do not need to appear in Java code
2. Defining UI and data structures using XML Markup Language
3. There are strict rules for the location of files stored in the project in the engineering catalog, and Android will be compiled from these standardized catalogs
Look for each file you need, and ask for similar files to be logically organized together
4. The Java code that drives the entire application is placed under the/SRC (source code) or/java directory, and you can create subdirectories first in the directory
5. Other files required by the application are stored in subdirectories under the/res (resources) directory. It is important to note that only subdirectories are stored in the/res directory and cannot be
Storing files directly, and creating a compilation error if the Android compiler finds the file directly in the directory.
A typical default resource (/res) directory structure contains 8 default directories:
The Layout:ui screen layout is stored in the/res/layout directory, and the UI layout is defined in the XML file format.
ANIM: XML files that define animations are stored in the/res/anim directory
Drawable:png format (Google recommended) or JPEG format (can be used, but Google does not recommend) the picture is stored in the/res/drawable (can
To draw the screen image) in the directory
Values: XML files that define constant values are stored in the/res/values directory
Color: XML text that specifies the associated color value for your application UI is stored in the/res/color directory
XML: XML files that define user data artifacts are stored in the/res/xml directory
Menu: The XML file that defines the menu layout is stored in the/res/menu directory
Raw: Uncompressed video files are stored in the/res/raw directory to tell Android that no further processing of these files is required
Typical files in the 6.values directory:
Colors.xml: An XML file that defines the color values used in the application, which can be used to standardize the UI
Dimens.xml: XML file for defining various dimension values
Arrays.xml: Used to define a series of XML files that need to be discarded using values (called arrays)
Styles.xml: Used to define the style XML file used in the application

7. Bitmap images

Naming conventions for bitmap images: Picture filenames can only contain numbers and lowercase letters and underscores, so be sure to remember this rule

To configure a bitmap picture for your application, follow these steps:

Name them correctly "use PNG or JPG format to make sure they are in the/res/drawable directory so that Android can find them."

8. Optional Resources
For example, to provide a different UI screen layout on a horizontal or vertical screen, to add an optional resource directory, you can create a subdirectory under the/res directory.
Name in the format "< Resource name >-< configuration modifier >"
If you want to use the appropriate picture for Android automatically from the catalog for the QVGA,HVGA,WVGA screen, you need to make the directory structure as follows
To configure:
/res: contains only subdirectories
/RES/DRAWABLE-LDPI: Contains low-pixel screen pictures
icon.png:32 x 32 pixels
background.png:320 x 320 pixels
/RES/DRAWABLE-MDPI: Medium pixel density screen picture
icon.png:48 x 48 pixels
background.png:320 x 320 pixels
/RES/DRAWABLE-HDPI: High pixel density screen picture
icon.png:72 x 72 pixels
background.png:800 x 480 pixels

9. Launch the application: Androidmanifest.xml
Launch Android app it will first go to look for manifest files, this file is always called Androidmanifest.xml file, convenient at startup
System found
The Androidmanifest.xml file defines some very advanced definitions and settings, written in XML Markup language, that contain key items such as:
References to application Java code so that Java code can be found and run by the system
Definitions of individual components in an Android application, and when they can be started
Definition of permissions for application security and communication with other applications
The minimum version of the Android operating system supported by the claim, which is equivalent to defining which versions of the app can support Android

Directory Structure of Android project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.