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

Source: Internet
Author: User

Context

Recently the actual combat under the overdraw, deepened the understanding. In the previous article Android Performance Optimizer Google course translation one: Render----overdraw

wrote a specific method.


Overdraw solution can not be separated from the view, give me the feeling seems to add a layer of view will add a layer. But essentially a name overdraw, or draw, and a few layers of view is okay. The following example:

Button

For example, the bookshelf and the bookstore are a button, and then I put the button on the Bookshelf

Findviewbyid (r.id.main_jump_shelf). setbackgrounddrawable (NULL);

I found that the bookshelf was a little less. The normal button was drawn two times, one for background, and the second for text. I guess at the bottom should be refreshed two times????

That is, the normal button 1 view---"2 times draw.

ImageView

And the share of the icon is ImageView, I give ImageView plus background will become 2 times. It turns from blue to green.

That is, ordinary ImageView 1 view----"1 times Draw

ImageView Plus background 1 view-----"2 draws


TextView

And if a textview specifies a size, but no text. Then he did not draw it at once.

That is, ordinary no text view----"0 times drawing


Glsurfaceview

Because Glsurfaceview is special, it is not in view Hierarchy (the tree structure of view), so he does not show excessive drawing.


Summarize:

That is to say overdraw, only and draw has the relation, the actual reflection that draws is the background color and other text and so on. View is just a wrapper class for this operation, which seems to have a one-to-one relationship, not really.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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

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.