Home > Enterprise >  How to create an image from xml or composable without rendering?
How to create an image from xml or composable without rendering?

Time:06-22

I need to create an image as per user input but without rendering the UI.

I know there is a way to render an image by inflating xml file and rendering on the UI or creating view programmatically without rendering.

https://stackoverflow.com/a/3527902

Android take screenshot via code

https://stackoverflow.com/a/9805831

However, is there a way to generate an image from xml without inflating or composable without rendering?

CodePudding user response:

In order to show something on the UI, it should be rendered first - with no exceptions. By the UI I mean any visual representation of your code - it doesn't matter either presented as an app view or just some image.

You can make inflation invisible to the user and render it silently if you don't want the user to see it before some event, but you still must render it. More info here and here.

Official docs about the stuff;

I don't know if the info above is helpful but the answer to your question - you have to render to see(show) something.

  • Related