How to get screen resolution in Android Honeycomb?

后端 未结 10 1814
情深已故
情深已故 2020-12-24 09:07

I want to get real resolution of screen on Android Honeycomb.

Here\'s my code

Display display = getWindowManager().getDefaultDisplay();
int w = displ         


        
10条回答
  •  一整个雨季
    2020-12-24 09:49

    Use the DisplayMetrics structure, describing general information about the display, such as its size, density, and font scaling.

    The code used to get the display's height is as follows:

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    
    Log.d("log", "OOO " + metrics.heightPixels);
    

    It's supposed to return the absolute height of the display, in pixels.

提交回复
热议问题