读书人

怎么获取屏的分辨率信息?

发布时间: 2012-03-08 13:30:13 作者: rapoo

如何获取屏的分辨率信息??
通过什么api,谢谢

[解决办法]

First you need to get the WindowManager by :

WindowManager wm = getSystemService(Context.WINDOW_SERVICE);

Next use the method to retrieve a Display object:

Display d = wm.getDefaultDisplay();

and finally the resolution:

int height = d.getHeight();
int width = d.getWidth();

读书人网 >Android

热点推荐