I create the following UI on Compose: I use an Im...
# compose
в
I create the following UI on Compose: I use an Image with a small bitmap as a background for the whole screen. On the screen is a list of elements (LazyColumn). Each element uses an
Image
with a vector image as a background. When scrolling through the list on a physical Pixel 3, strong lags are observed (everything is ok on emulators). Moreover, if I replace
Image
with
Canvas
and draw images manually through Canvas, then there are no lags when scrolling. Lags are observed in both debug and release versions. Tell me please how to fix the lags?
r
Make sure your images are not reloaded on every recomposition.
в
Images are not reloaded on every recomposition. Only function “draw” is called every frame on PainterModifier inside “Modifier.paint” under the hood of image. I suppose app lags out of function “paint”. It lags when I have several big images (full screen or almost full screen)
m
Without any code its hard to help you. Please provide min code
в
I solved the problem. The application part code would not help, unfortunately. The problem was that on previous screens that were displayed behind the current one with the same background, the same large picture was displayed in full screen. It turned out that the same picture was drawn several times on top of each other.