Join Slack
Powered by
Hi! When I get the width of e.g. a Box , I get for...
# compose-desktop
f
Frank
09/17/2021, 7:18 AM
Hi! When I get the width of e.g. a Box , I get for example 1600, I guess this is in Pixel and not in DP?
i
Igor Demin
09/17/2021, 10:14 AM
Usually, if Compose returns something in Float or in Int, it is pixels, not Dp. If you need to convert it to Dp, use this:
Copy code
with(LocalDensity.current) { value.toDp() }
2
Views
Open in Slack
Previous
Next