Skip to content

Snapshot view

Version 0.5.4

viewSnapshot can convert the view into Bitmap for saving.

For inflated views

Version 0.5.4

val bitmap = viewSnapshot(mBinding.snapshotWait)

For uninflated views

Version 0.5.4

Note

For uninflated views, you need to provide the width and height of the view by SnapshotOption .

val view = LayoutInflater.from(this).inflate(R.layout.viewgroup_inflate, null, false)
val bitmap = viewSnapshot(view, SnapshotOption(1080, 540))

Sample code

Sample code