Geekband Job 13--View optimization

Source: Internet
Author: User

Bug Project Address: Https://github.com/lzyzsd/AndroidUIPorblems


This job is view optimized, before running the program, tick show GPU in developer Options Overdraw


1. The program homepage is as follows



The over-drawn area of 3X and above has the text above the button and the entire linearlayout below.

Two button over-drawing is due to the entire interface background and button default background overlay, this is a reasonable demand, so do not change.

The following linearlayout background and interface background, can be deleted, the effect is as follows.



2. Open the Overdrawview interface



Draw four rectangles, the first to fill the entire interface, the second from the height of the interface 1/4 to the bottom, the third and fourth from the 1/3 and 1/2 are drawn down. As a result, the more the interface is drawn down, the greater the degree.

Instead, draw only the visible portion of each rectangle, with the following effect:



3. Open Busyondraw


There is no serious problem of over-drawing.

Originally wanted to use the profile GPU rendering to view, but the computer performance is too poor, the operation of the simulator is very card, see the effect, can only operate on the real machine, the results show jump a bit of lag.

View Code Discovery There is a circular 1k System.out.println operation in the OnDraw method of the custom control, plus 30 of the loaded custom controls, which is equivalent to doing 3W in a UI thread.

Then delete the background output operation, rerun, the page jumps smoothly.


Geekband Job 13--View optimization

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.