Rafs
11/27/2020, 11:57 AMloloof64
11/27/2020, 12:21 PMWithConstraints {
val width = constraints.maxWidth
val height = constraints.maxHeight
}
See, if you can, a previous thread where someone gave me these advices.selcukbulca
11/27/2020, 12:25 PMConfigurationAmbient
to get screen width and height dp values, then convert them to pixels with DensityAmbient
val screenWidthDp = ConfigurationAmbient.current.screenWidthDp
val screenHeightDp = ConfigurationAmbient.current.screenHeightDp
val (screenWidthPx, screenHeightPx) = with(DensityAmbient.current) {
screenWidthDp.dp.toPx() to screenHeightDp.dp.toPx()
}
loloof64
11/27/2020, 12:26 PMRafs
11/27/2020, 12:27 PMjim
11/27/2020, 4:53 PMWithConstraints
is most likely what you're looking for. The composable should be reacting to the immediate space available, not to the number of pixels that the device happens to have; otherwise your composable will likely behave wrong when placed in a smaller context.