Android view system overview

Source: Internet
Author: User

The android view system defines the entire process from user input to message processing.

For example, after a user generates an input message through an input device such as a touch screen or a hard keyboard, the message is first processed by the message processing front-end and converted to a unified message value at the upper layer of the system.

For example, when we press the return key (hard keyboard), different mobile phones may have different values for the Return key due to hardware reasons. But how can we handle them in the upper layer, the front-end processes the messages (maybe the so-called driver is used to process hardware messages), and then sends the processed values to the subsequent message processing module, the processed value is the unified value of the system, that is, all the values seen during application development. keycode_back

Next, let's talk about the window management system. The window management system determines which window the user is interacting with based on the bit change of all windows, and then sends the message to the current window.

If it is a key message, it is directly sent to the current window. If it is a touch message, the window management system will match all the Windows based on the message coordinates to determine which window the coordinates belong, then the message is sent to the corresponding window.

After the message is sent to the corresponding window, how to process the message is the window's own business.

After the view in the window obtains the message, it sends the message according to the default logic. The message is mainly distributed to all subviews so that the corresponding subview can obtain the message, and execute the same job. If the interface changes, the interface is re-painted.

The re-drawing interface process consists of three steps:

(1) Calculate the size of all views in the window. This step is used to measure the size of all views.

During the measurement process, all views are assigned an accurate value. All the wrap_content, match_parent, and fill_parent values are converted to the correct value.

(2) assign positions to all views. This step is the layout process, which determines where the view should be placed on the screen.

(3) Draw the view to the screen.

After calculating the view size and position, you can determine which view to draw and which do not need to be drawn. During the painting process, the system creates a canvas object for each window and passes the canvas object

Subview. If the view system passes the canvas object to the sub-view, it will first crop the canvas. In this case, the sub-view is like holding an independent canvas, which is from (0, 0) the coordinates are actually drawn on the same canvas.

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.