开发者

Too many dispatchDraw, why?

I am having an activity with two ViewGroup as it's children, and each ViewGroup has one or more views in it. I found that the dispatchDraw() is being called four times each time I make change, and 10 times when I use ViewFlipper to flip to next or previous. It really kills my performance, but I can't find out where these draws come from by Thread.dumpStack. They all look identical in the 开发者_如何学Gostack dump. Does anybody know when will Android calls dispatchDraw, which in turn calls onDraw of view? I know there's an article in dev guide telling me HOW Android draws views, but it doesn't tell me WHEN.


dispatchDraw() is called whenever a View needs to be redrawn. Which means it will be called whenever invalidate() (or postInvalidate() is called.) Note that invalidate() calls are coalesced when they happen on the same UI thread event.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜