Skip to content Skip to sidebar Skip to footer

Draw Inflated Layout Xml On An Bitmap

I created a layout xml file that contains an extended textview. What I want is to draw the textview in a bitmap. What do I have to do after inflating the view so that I can use the

Solution 1:

Below are the steps to perform what you want:

  1. You have to create a mutable Bitmap (with the size of the screen).
  2. Create a Canvas from that Bitmap.
  3. inflate your view, get a reference to it.
  4. Call your_view.draw(your_canvas).

That's all, in your Bitmap you will have your view and all of it children drawn.

Post a Comment for "Draw Inflated Layout Xml On An Bitmap"