Android: Draw a view on canvas

前端 未结 4 791
栀梦
栀梦 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:06

    Solution is to translate canvas:

    canvas.save();
    canvas.translate(left, top);            
    view.draw(canvas);
    canvas.restore();
    

提交回复
热议问题