Android-ui Foundation

Source: Internet
Author: User
<span id="Label3"></p><strong><strong><span style="font-family:KaiTi_GB2312; font-size:24px">Android-ui Foundation</span></strong></strong><span style="font-family:KaiTi_GB2312; font-size:18px"><span style="font-family:KaiTi_GB2312; font-size:18px"> <strong>a UI and UI interface</strong><br>UI is the user interface<br>The UI inherits View's base class, looking at the source of the view<br></span></span><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">The basic architecture of the ui, with a picture:</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px"><br></span></p></p><span style="font-family:KaiTi_GB2312; font-size:18px"><strong><strong>Two common Concepts</strong></strong><br>UI rendering, UI events, UI Layout<br>The concept of the control tree: ViewGroup can have viewgroup or view below<br><br><strong><strong>Three-custom Interface View</strong></strong><br>1 Custom view class inherits from the system view,<br>2 then instantiate the object of the custom view class in activity X<br>3 Last Setcontentview (x)<br>Code tracking is possible<br>1 activity->phonewindow->view->layout<br>2 Activity->phonewindow->doceview<br>3 How to draw within a canvas<br>4 View class OnDraw<br><strong><strong><br>The underlying mechanism of the Four-interface component rendering</strong></strong><br>1 under surface is the image display driver, character device Driver: framebuffer<br>2 skia:2d Class Library<br>3 Opengl:3d Class Library<br>Such as:<br><br><br><strong><strong>five Android interface event mechanism</strong></strong><br>1 Event Categories:<br>Keyevent: Hard Keyboard Click events<br>Touchevent: Touch Event<br>Both view and activity have the above two event mechanisms<br>Trackballevent: Trackball Event<br><br>2 event-triggered Two Methods:<br>Internal Method:<br>Callback the corresponding event function when the view is extended<br>OnKeyUp<br>Ontouchevent<br>Note that you need to set the focus of the custom control<br>Setfocusable (true);<br>Setfocusableintouchmode (true);<br><br>External methods:<br>Registering event Listeners<br><br>3 Time Distribution Dispatchkeyevent:<br>KeyEvent distribution:<br>The message is sent to the current context<br>Context sent to Window<br>Window priority to IME form<br>Issued to Rootview (decorview)<br>Issue Focus View (event receive mechanism returns false by default, allowing next Acceptance)<br>Custom Control->linux through pipe interprocess communication to->activity->phonewindows->rootview-> Focus View<br><br>TouchEvent distribution:<br>From bottom to Top:<br>Custom Control->rootview->phonewindow->activity<br><br><strong><strong>six custom interface rendering</strong></strong><br>Interface Rendering Mechanism:<br>1 rendering in two ways:<br>Xmllayout rendering<br>Dynamic encoding implementation: dynamic layout and painting of dynamic controls<br>2 presentation core: Use of the OnDraw method<br><br><strong><strong>Seven Supplement</strong></strong><br>User interaction designer: give specific ideas and UI diagrams<br>Visual Artist: the real interface for realizing ideas<br>Interface implementation: Programmer or visual designer with strong coding ability<br>Why the interface is xml: can be separated, programmers can not control the layout of xml, so that visual designers to achieve<br><br><strong><strong>Eight-side Questions</strong></strong><br>1 view is the base class for all controls, saying that he has a relationship with activity and window<br>2 What is the core of view, can you say the OnDraw function inside<br>3 How custom components implement custom events<br>What is 4 ninepatch? Requirements will be used<br>5 Introduction to the interface event mechanism of Android</span><p><p>Android-ui Foundation</p></p></span>

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.