问题
I use the below code to get the width of a Galaxy S6 screen in pixels
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
Log.i("INFO", "width pixels "+metrics.widthPixels);
On one app this returns 1440 which is correct as per Samsung. On another app the same code returns 1080 ??
density also changes from 4 to 3 as well as xdpi 580 to 435
Any ideas why I'm getting two different results? Both apps target the same SDK: 23 and min SDK: 10
回答1:
The different resolutions are caused by the gameservice
on Samsung devices. You can check this by installing the Samsung Game Tuner on the device and setting your application to full mode. AFAIK there's no programatic way to set the app to full mode.
来源:https://stackoverflow.com/questions/36757198/galaxy-s6-screen-dimensions-android