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