Android Development Road 01

Source: Internet
Author: User

I. Android system is divided into 4 levels: 1. The bottom-most of the Linux kernel, including multiple drivers, provides the core functionality that the operating system should have; 2. Above the Linux core, including two sections, part of the 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 (i.e., various managers, such as resource managers, etc.); 4. Aplication layer (this layer is the domain app for our work)
Two. Component-based application development: This approach makes Android development simple, encapsulates the required functionality into a single component, and uses the corresponding component development when developing the app. Android components: ①activity:activity is equivalent to the page on the site, ②service:service is mainly responsible for long-time operation in the Android operation, it does not have a graphical interface; ③content Provider: A way to share data, if my app has a content Provider, then other programs will be able to access my app. ④broadcastreceiver: Broadcast receiver, which is the role of listening to what happens in the phone, it is used to monitor the behavior of the system (for example: When the phone enters low power, then the phone will send a broadcast to the application, if the user is playing games, Then you should give the user prompt after getting the message from the system.
Three. First knowledge of activity:
1.Activity start-up process: Before ①activity starts, The Android operating system first reads the Androidmannifest.xml file, decides which activity to start, then generates the default activity object, and then calls the object's OnCreate () method (which is done by the Android operating system), on The Create () method will also read the layout file main.xml, according to the contents of the layout file to determine what the activity should be displayed;
2.Activity relationship to layout files: ①relativelayout: Is relative layout, the relative layout of the container within the scope of the control is used relative layout ②textview: That is, the text view, which is used to display text;
3. Get the delegate control object in the activity: there is a TextView object in the activity, and in Main.xml there is a declaration of the <TextView> control, then it can be said that the TextView object is the object that represents the control. When a layout file is to be read in the OnCreate () method, the activity generates the object corresponding to the control in the layout file, and we get the object that represents the control through Findviewbyid (), and because Findviewbyid () The returned objects are all view types, so we have to move down to the corresponding object type; We can control the properties of the control in the layout file, and we can control the property in the activity.
Three.
The basic concept of 1.View: the control shown in activity, in the Android technology system is View,view is the parent class of all control classes, each control corresponds to a class, these classes are all the class of the view;
2. Get the object representing view in activity: Findviewbyid ();
3. Set the properties of the view: one is in the layout file, one is in the activity;
4. Set the listener for the view
5. Bind the listener to the control: ① gets the object that represents the control; ② defines a class that implements the listener interface; ③ generates a listener object; ④ binds the listener object to the control
Four.
1. Basic concept of Control layout: control layout is the way to charge the position, size, color, and other style properties of the item in the activity. Complete the control layout using the layout file and complete the control layout in the Java code. There are two ways to do this: ① to complete the layout of the control in the layout file; ② to complete the layout of the control in Java code
2. Layout Method Classification: LinearLayout (linear layout), Relativelayout (relative layout) in actual development, the relative layout is the most we use. In a linear layout, each control has a single row, or a column, independent of the length of the control's content.
Five. Length units and internal and external margins
1. PX of distance unit: that is, pixels, for example, what we call the screen resolution is 480*320 that is, in the horizontal screen is divided into 480 parts, vertically divided into 320 parts. And the whole screen is divided into 480*320 lattice, and each of these small lattice is a pixel;
2. The dp:dpi of the distance unit is the number of dots per inch, which is how delicate the screen is. 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 the screen at DPI 160:1dp=1px
3. Distance unit sp;scaled pixels (scalable pixels) is typically used to specify the size of the font, and the SP changes when the user modifies the phone display font.
4. Margins and padding for controls: margin and padding
Six.
1. Basic concept of radio buttons: the difference between a radio button and a multi-select button is that only one of the set of buttons can be selected;
2.RadioGroup and RadioButton
3.OnClickListener and Oncheckedchangelistener Listener
4.ImageView
Nesting of 5.LinearLayout layouts
6.layout_weight: Child control does not fill the space of the parent control, Layout_weight value is used to specify the allocation scale for free space
7.RelativeLayout: Relative layout is achieved by specifying the relative position between the current control and the sibling control, or the parent control, to control the position of the control. Relativelayout new properties for layouts (after Android 4.2)
Seven.
1.timepicker;2.datepicker;3.progressbar;4.ratingbar

Android Development Road 01

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.