[Points]Canvas and Drawables

origin article: http://developer.android.com/guide/topics/graphics/2d-graphics.html

translation: http://www.cnblogs.com/jsaint/articles/3427728.html

Draw style

  • bind layout view
  • canvans draw

On the View

  1. do draw in View onDraw() function
  2. invalidate() request system call onDraw
  3. postInvalidate() not in Ui thread

On a SurfaceView

  • async draw

Drawables

creaet function

  • saved as res images
  • create in xml(AnimationDrawable and so on)
  • new using constructors
  • notice image res may be automatically compression if you do not want put in res/raw/

create form resource images

  • using resouce id (both in code and xml)

drawables

  • ShapeDrawable(basic shape)
  • NinePatchDrawable(can be stretch)
posted @ 2013-11-17 17:01  Jsaint  阅读(162)  评论(0编辑  收藏  举报