Android DisplayMetrics returns incorrect screen size in pixels on ICS

前端 未结 6 1095
花落未央
花落未央 2020-11-27 03:24

I\'ve tried this....

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int fullscreenheight = metric         


        
6条回答
  •  猫巷女王i
    2020-11-27 04:03

    On some devices, e.g. tablets, the navigation bar can't be hidden at all (source, see section 'Controls for system UI visibility') because there's no hardware buttons as backup. If on your device you've managed to hide the bar though, you could make a full screen View and request its size with getWidth() and getHeight().

    As far as I know, there isn't a reliable way to get the screen size on all ICS devices.

提交回复
热议问题