Ahmed
02/16/2025, 5:41 PMLazyVerticalGrid
with different grid spans. Within that grid I want a special kind of transparent item that can act as a window to what’s behind the grid. More in 🧵Ahmed
02/16/2025, 5:41 PMAhmed
02/16/2025, 5:41 PMAhmed
02/16/2025, 5:42 PMBox {
FullScreenSurprise()
LazyGrid()
}
Ahmed
02/16/2025, 5:43 PMAhmed
02/16/2025, 5:44 PMAhmed
02/16/2025, 5:46 PMSkaldebane
02/17/2025, 12:37 AMdrawRect
with BlendMode.Clear
, but that would (afaik) create a hole through the entire Compose view (not just that composable, it'll punch through everything behind it). Not sure if there's another way...Skaldebane
02/17/2025, 1:26 AMgraphicsLayer
modifier with CompositingStrategy.Offscreen
to the parent composable (in this case, the LazyVerticalGrid
):
LazyVerticalGrid(
...,
modifier = Modifier
.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)
...
)
Then you can apply BlendMode.Clear
on the child composable, and it'll only clear all the way up to the parent, because the parent created a separate graphics layer:
YourChildComposable(
...,
modifier = Modifier
.drawWithContent { // if you don't care about the content, you could use drawBehind instead, or use a Canvas directly.
drawRect(Color.Black, blendMode = BlendMode.Clear)
drawContent() // only if you want to keep content (e.g. some overlay), if any.
}
...
)
That'll achieve the desired behavior.Ahmed
02/17/2025, 6:18 AM