Artur Schwarz
10/13/2021, 8:22 AMHorizontalPager(state = pagerState, modifier = Modifier.fillMaxSize()) { page ->
AndroidView(factory = {
val zoomableImageView = ZoomageView(it).apply {
setImageBitmap(BitmapFactory.decodeFile(images?.get(page)?.path))
restrictBounds = true
}
zoomableImageView
}, modifier = Modifier.fillMaxSize())
}
A bit background info:
This is basically an Image Preview Screen which displays the selected image and allows the user to navigate through images via swipe. I’m using an AndroidView to display the images, since there seems to be no proper implementation of a zoomable and draggable image in compose.
The out of memory error occurs when scrolling through pages long enough.
Possibly a bug in compose/horizontal pager?cb
10/13/2021, 8:30 AMArtur Schwarz
10/13/2021, 8:32 AMAlbert Chang
10/13/2021, 8:37 AMArtur Schwarz
10/13/2021, 8:38 AMmyanmarking
10/13/2021, 8:39 AMArtur Schwarz
10/13/2021, 11:39 AMcb
10/13/2021, 12:11 PMfit()
so that it downscales the images to fit the available size.Artur Schwarz
10/13/2021, 12:14 PM