https://kotlinlang.org logo
#compose
Title
# compose
n

Nat Strangerweather

09/18/2020, 3:39 PM
Is it possible to detect whether the device is using Gesture navigation or 3-button navigation, as I would like to organise my layout accordingly to avoid large empty areas... I am currently using
Copy code
if (ConfigurationAmbient.current.screenHeightDp >= 750) {
    Spacer(modifier = Modifier.height(40.dp))}
but it does not appear to reflect whether there is a nav bar or not
f

flosch

09/18/2020, 3:50 PM
You cannot reliably detect gesture navigation with screen height. Every device has different screen sizes. I don't think there is a reliable way to detect that at all. google tells me there are some hacks, like querying some resource identifier, but I am quite sure that this will not work for all devices
👍 1
s

satyan

09/18/2020, 3:51 PM
You might be able to use insets
👍 1
n

Nat Strangerweather

09/18/2020, 3:52 PM
Ok, thanks, never mind, it's not a big deal... 🙂
f

flosch

09/18/2020, 3:52 PM
I don't think insets will tell you much. You could compare the current bottom inset with a fixed dp value, but gesture navigation must not have the same height for each manufacturer.
5 Views