Search code examples
javaandroidkotlincanvaslayout

How to draw LinearLayout in canvas?


canvas.drawText() draws text on the canvas. How can I draw a linear layout on the canvas?

Something like canvas.drawLinearLayout() would be excellent but it doesn't exist.


Solution

  • Not really enough info provided about the state of the LinearLayout (has it been drawn already)

    But if it has been drawn already then

    myLinearLayout.draw(canvas)

    will get the LinearLayout to draw itself the the specified canvas.