View.onDraw() — when does it get called?

前端 未结 6 1599
野趣味
野趣味 2020-12-29 02:42

I put a Log.d() call into the onDraw() of my extended View, so I could see how often and when it\'s getting called. It gets called upon instantiation of the view, which is

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 03:17

    One important thing to keep in mind is that try to minimize calling of invalidate() function with no arguments. Instead try to maximize the invalidate() function with four arguments.As drawing whole view is very expensive.The second variant refreshes only the part of view.

提交回复
热议问题