문제

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?

도움이 되었습니까?

해결책 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;

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top