Search code examples
androidscreen-size

Whats the appropriate way to work with phone screen size?


The following code returns the screen size:

Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();
int height = display.getHeight();

I'm using RelativeLayout to arrange components inside. For some reason when I divide width between components (say width*30/100 and width*70/100) I get some screen space left out. And also about the height how can I get height of status bar and title bar does it vary among phones?


Solution

  • this would help you. It states the difference in the sizes of status bar.