Search code examples
androidscreen-resolution

What is the screen height of an android device as thrown by metrics?


I'm writing an app that I want it to work with different screen sizes.

While in portrait mode I divide the screen height by 5 in order to set it the result as the height for text views. Hence no matter what screen there should allways be five textviews.

I have a tablet with a 1280 pixel height, which display metrics height returns as 1232. In my phone with 1980, display metrics height shows 1776. These are the values that I divide by 5.

I see the 5 textviews in my tablet perfectly but in my phone the lasts textview is almost entirely off the screen. So my question is what is the height that is returned?


Solution

  • That height returned is the screen height, minus the height of the notification bar. But you still have things like the action bar taking space.