Android performance optimization Google course translation one: Render----overdraw

Source: Internet
Author: User

Context:

Continuing with the above article, we already know how to collect information to find Overdraw. Now, how do we solve it?

Method:

Background color:

1. Remove the extra background color:

In the OnCreate () method, add: GetWindow (). setbackgrounddrawable (NULL);

(I have just started in Beijing is opaque opaque)

2. Locate the background color of the underlying view and remove it.

Clip clipping:

The Android system cuts the overlapping view, counting only the displayed parts. However, this feature does not extend well to custom view, so you need to do some processing yourself. For example, Microsoft comes with a game of hearts, stacked cards, only the first card all exposed, and his only exposed the number of vertical bars.

1.canvas.cliprect (RECTF rect)

When this method is called, the area outside the rect rectangle is no longer drawn. (Oh, roar!)

2.canvas.quickrect (RECTF rect, Edgetype type)

Used to determine whether the rect intersects with the current clipping region and does not want to return ture;


(The bottom of the area must be the entire view to clip off, I cut a little found no, do not know what happened)



Android performance optimization Google course translation one: Render----overdraw

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.