Android: Draw a view on canvas

前端 未结 4 836
栀梦
栀梦 2021-01-13 02:14

I have a view inflated, I can draw it on canvas, but can\'t seem to position it properly.

LayoutInflater li = (LayoutInflater)context.getSystemService(Contex         


        
4条回答
  •  佛祖请我去吃肉
    2021-01-13 03:01

    because the coordinate system used in the Canvas starts from the top left corner instead of doing that define your Custom View and override the onDraw() method and inside it position your view as you like

提交回复
热议问题