Question

I am trying to figure out the dimensions for the S4. What is the width and height. I want to create graphics and place them based on h and w. I read that the screen size ranges from 0-h and 0-w, but what are h and w?

Était-ce utile?

La solution 2

Here's some handy code if you need to find the size of various devices:

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int screenWidth = size.x;
int screenHeight = size.y;

Autres conseils

S4 screen specs are 1080 x 1920, but you shouldn't use the actual screen size in pixels in your code. Just use dp - which is a size which is independent in the screen density to design you Android app UI, this way, it will behave nicely for all screen sizes. For more details see Supporting Multiple Screens Guidelines.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top