Custom Drawing | Android Developers - 1 views
-
Creating objects ahead of time is an important optimization. Views are redrawn very frequently, and many drawing objects require expensive initialization. Creating drawing objects within your onDraw() method significantly reduces performance and can make your UI appear sluggish.
-
Simon Pan on 24 May 13將物件在初始化時就實例化是很重要的概念,onDraw()的運作速度很快,如困每一個Paint畫圖物件都臨時才在onDraw()產生,將會大幅下降整体程式的流暢效能。
-
-
If your view doesn't need special control over its size, you only need to override one method: onSizeChanged().
-
is mandatory.