トラッキング コード

8/25/2011

About Display in HoneyComb

There was the following question at stackoverflow site.

How can I get android Honeycomb system's screen width and height?


I think Display.getHight was include SystemBar.
I have confirmed the following things in NexusS and Xoom.

Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
display.getMetrics(displayMetrics);
        
Log.e("","------------------ ");
Log.e("","display.getHeight() = " + display.getHeight());
Log.e("","display.getWidth() = " + display.getWidth());
Log.e("","------------------ ");
Log.e("","displayMetrics.heightPixels = " + displayMetrics.heightPixels);
Log.e("","displayMetrics.widthPixels = " + displayMetrics.widthPixels);
Log.e("","------------------ ");



Results were as follows:

Nexus S
    display.getHeight() = 800
    display.getWidth() = 480

Xoom
    display.getHeight() = 752
    display.getWidth() = 1280



Xoom will not include status bar height.

getHeight() is include statusbar in GingerBread, not in Honeycomb.

No comments:

Post a Comment