Android development road 01, android road 01

Source: Internet
Author: User

Android development road 01, android road 01

I. android systems are divided into four levels: 1. the bottom layer is the linux core, including multiple drivers, providing the core functions that the operating system should possess; 2. on the linux Core, there are two parts: Android Runtime (including the Dalvik virtual machine, and Core Libraries is equivalent to jdk in java) and LIBRARIES; 3. is the Application Framework layer, which includes multiple Android development frameworks (such as various managers, such as resource managers); 4. aplication layer (this layer is a domain app for our work)
2. Component-based application development: This method simplifies Android development, encapsulates required functions into one component, and uses corresponding components for development when developing apps. Android components: ① Activity: Activity is equivalent to a page on a website; ② Service: Service is mainly responsible for operations that take a long time in Android operations. It does not have a graphical interface; ③ Content Provider: data sharing: If my app has a Content Provider, other programs can access my app. ④ BroadcastReceiver: A broadcast receiver that monitors what happens on a mobile phone. It is used to monitor system behavior (for example, when a mobile phone enters low power, then the mobile phone will send a broadcast to the application. If the user is playing a game, should the user be prompted after obtaining the message sent by the system)
3. First knowledge of Activity:
1. activity startup process: ① before the Activity is started, the Android operating system first reads AndroidMannifest. the xml file determines which Activity to start, generates the default Activity object, and calls the onCreate () method of the object (these operations are completed by the Android operating system ), in the onCreate () method, the layout file main will be read again. xml: determines what the Activity should display based on the content in the layout file;
2. relationship between Activity and layout files: ① RelativeLayout: relative layout. controls within the container range of the relative layout use the relative layout method ② TextView: Text View, it is used to display text;
3. obtain the control object in Activity: in Activity, there is a TextView object, and in main. the <TextView> control declaration in xml indicates that the TextView object represents the control object. When the onCreate () method needs to read a layout file, in this case, the Activity generates the object corresponding to the control in the layout file. We use findViewById () to obtain the object representing the control. Also, because findViewById () returns all View objects, therefore, we must transform down to the corresponding object type. We can control the properties of the control in the layout file, and also control the properties in the Activity;
III.
1. basic concept of View: the control displayed in the Activity is View in the android technical system. View is the parent class of all control classes, and each control corresponds to a class, all these classes are subclasses of View;
2. Get the object representing the View in the Activity: findViewById ();
3. Set View attributes. One is in the layout file and the other is in the Activity;
4. Set a listener for the View
5. Bind a listener to the control: ① obtain the object representing the control; ② define a class to implement the listener interface; ③ generate the listener object; ④ bind the listener object to the control.
4.
1. Basic Concept of control layout: control layout refers to the position, size, color, and other style attributes of the control in the Activity. Use the layout file to complete the control layout and complete the control layout in java code. There are two ways: ① complete the control layout in the layout file; ② complete the control layout in java code
2. Classification of layout Methods: LinearLayout (linear layout). RelativeLayout (relative layout) is the most widely used layout in actual development. In a linear layout, each control excludes one row or column, regardless of the length of the control content.
5. length unit and internal and external margins
1. pixel of the distance unit: pixel. For example, the screen resolution we call is 480*320. That is to say, the horizontal screen is divided into 480 parts, and the portrait is divided into 320 parts. The screen is divided into 480*320 grids, and each small grid is a pixel;
2. dp: dpi indicates the number of dots on each inch, that is, the degree of detail displayed on the screen. The higher the dpi value, the higher the screen resolution, and the lower the screen resolution; dp = dip (Device Independent pixels) conversion formula: px = dp * (dpi/160) on a screen with dpi 160: 1dp = 1px
3. sp of the distance unit; scaled pixels (Scalable pixels) are usually used to specify the font size. sp will change when the user modifies the font displayed on the mobile phone.
4. Control margin and padding: margin and padding
6.
1. Basic concepts of Single-choice buttons: The difference between single-choice buttons and multiple-choice buttons is that only one button in a group can be selected;
2. RadioGroup and RadioButton
3. OnClickListener and OnCheckedChangeListener listeners
4. ImageView
5. nested LinearLayout Layout
6. layout_weight: The child control cannot occupy the space of the parent control. The value of layout_weight is used to specify the proportion of idle space allocation.
7. RelativeLayout: The relative layout is to control the control position by specifying the relative position between the current control and the sibling control or the parent control. New Properties of RelativeLayout layout (after Android 4.2)
7.
1. TimePicker; 2. DatePicker; 3. ProgressBar; 4. RatingBar

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.