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