Android learning basics-engineering file Composition

Source: Internet
Author: User
1 SRC Source File Folder COM. example. appname package name mainactivity activity class Gen save automatically generated R Resource class folder com. example. appname package name R. android 3.0-> android. jar Android sdk jar file assets save the res resource folder of the original resource file drawable Save image and other resource folders drawable.icon.png .. save icons and other external resource files layout interface layout folder Layout-> main. XML interface layout file values simple Value configuration folder values-> strings. XML string configuration file androidmainfest. XML Android configuration list file 2 mainactivity. java, inheriting activity class, medium Call the setcontentview method to display the View Interface public class main extends activity {protected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. activity_main);} r. layout. activity_main is R. A property in the Java Resource class 3 R. java program code public final class r {public static final class ATTR {} public static final class dimen {public static final int activity_horizontal_margin = 0x7f040000; Publ IC static final int ready = 0x7f040001;} public static final class drawable {public static final int ic_launcher = 0x7f020000;} public static final class ID {public static final int action_settings = 0x7f080000 ;} public static final class layout {public static final int activity_main = 0x7f030000;} public static final Class Menu {public static final int main = 0x7f070000;} public Static final class string {public static final int action_settings = 0x7f050001; public static final int app_name = 0x7f050000; public static final int hello_world = 0x7f050002 ;} public static final class style {public static final int appbasetheme = 0x7f060000;/** application theme. all mizmizations that are not specific to a special API-level can go here. */public static final int apptheme = 0x7 F060001 ;}} the file is automatically generated by the system. attributes are declared in ATTR. Some image resources are declared in drawable. layout declares the layout file. setcontentview (R. layout. activity_main) is used to access the activity_main.xml layout file in the layout folder of the project by accessing the activity_main attribute of the internal class layout of the Resource class R. The view component string is displayed on the interface. XML to declare the string constants used in the system. Code <relativelayoutxmlns: 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: paddingbottom = "@ dimen/activity_vertical_margin Android: paddingleft =" @ dimen/plugin "Android: paddingright =" @ dimen/plugin "Android: paddingtop = "@ dimen/activity_vertical_margin" tools: context = ". main "> <textview Android: layout_width =" wrap_content "Android: layout_height =" wrap_content "Android: TEXT = "@ string/hello_world"/> </relativelayout> the first behavior is relative to relativelayout, the vertical attribute indicates that the component is vertically placed fill_parent, indicating that the layout width is filled with the parent component wrap_content, indicating that the component width is filled with the parent-child 3 androidmanifest. XML, which is a global configuration file of the android project. All the components used are declared in this file.
Related Article

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.