Get the screen height in Android

前端 未结 9 1193
忘了有多久
忘了有多久 2021-02-05 09:57

How can I get the available height of the screen in Android? I need to the height minus the status bar / menu bar or any other decorations that might be on screen and I need it

9条回答
  •  梦毁少年i
    2021-02-05 10:20

    How about setting up a subclassed View as the root of the Activity. Make this View fill the screen (it won't go past the status bar) and override onSizeChanged(). Store those values and write a getter for them.

提交回复
热议问题