-1

Is that possible to convert one activity with a constraint layout to an image? I use LayoutInflater and then screenView, but there is one problem that screenView.getMeasuredWidth and screenView.getMeasuredHeight always return 0.

  • Does this answer your question? [How to render an android view to canvas WITHOUT rendering it first (i.e. without full layout)](https://stackoverflow.com/questions/60582424/how-to-render-an-android-view-to-canvas-without-rendering-it-first-i-e-without) – Andrew Jun 23 '22 at 15:05
  • No, I need to convert the whole activity – user9260306 Jun 23 '22 at 15:07
  • An Activity just displays a view, as your `screenView` object is just a `view` you can use this method to create a bitmap (image) of it. – Andrew Jun 23 '22 at 15:20

1 Answers1

0

Here's a library that can do what I think you're requesting: https://github.com/dfraska/PixelShot

Gavin Wright
  • 3,124
  • 3
  • 14
  • 35