https://kotlinlang.org logo
#android
Title
# android
e

Elka

05/28/2020, 3:00 PM
Any idea on how to get the screen height on Android... Trying to use
Display.getMetrics
but the API is not consistent... On some devices the method includes the status bar height while on others it gives only the usable area of the screen...
a

allan.conda

05/28/2020, 3:14 PM
do you want to include the nav bar? use getRealSize from 19 onwards if you want to add it
e

Elka

05/28/2020, 3:16 PM
no I just want the part of the screen without the nav and status bars
o

Olenyov Kirill

05/28/2020, 4:57 PM
Why do you need to know the “usable” screen height? What is your task?
e

Elka

05/29/2020, 6:35 AM
want to open a full screen dialog...
o

Olenyov Kirill

05/29/2020, 7:09 AM
Try to set MATCH_PARENT height to your layout and add flag to your dialog’s window:
Copy code
LayoutParams.FLAG_FULLSCREEN
e

Elka

05/29/2020, 7:11 AM
okay thanks
3 Views