Android Application Architecture Analysis

Source: Internet
Author: User

First, res directory:

1, properties: Android required;

2, the role: the storage of Android projects of various resource files. These resources will automatically generate R.java.

2.1, Layout: the storage interface file.

2.2, Strings.xml: string resource file;

2.3, Colors.xml: color resource file;

2.4, Dimens.xml: size resource file;

2.5, drawable-ldpi,drawable-mdpi,drawable-hdpi: are small, medium and large size picture files.

3. Use:

3.1. Access to resources:

1, use: @ Resource Class name/resource item name.

2. Use the @id/glyph: The Android component needs to be represented by the ID attribute value in the tag, which is of type int and can only be a value of the resource type, that is, the value represented in the resource file XML, which is parsed with @. such as: @id/abc,@+id/xyz. Where both ABC and XYZ are defined in the resource file. The "@" symbol prompts the XML parser to parse the subsequent string into a glyph. "id" indicates that the glyph will be categorized under "IDs". "@+id/xyz" indicates that an item will be added to the R.java ID inner class as public static final int xyz=0x*****, followed by a hexadecimal value. If XYZ already exists, it is no longer incremented.

Get the component in the program, use Findviewbyid (), get the component in XML, use a resource reference: @id/glyph.

Second, src directory:

1, properties: Android required;

2, Function: Save Java source files;

Iii.. androidmanifest.xml file.

1, properties: Android required;

2, role: The global profile of the Android project, to control the Android app name, icon, access rights and other overall properties.

Iv.. R.java file:

1, Location: Gen directory;

2. Function: A class file automatically generated according to the resource file, similar to the resource dictionary of Android application.

3. Composition:

3.1. Each class of resources corresponds to an inner class of R class.

Android Application Architecture Analysis

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.