方法一:
windowmanager wm = (windowmanager) this方法二:.getsystemservice(context.window_service);
int width = wm.getdefaultdisplay().getwidth();
int height = wm.getdefaultdisplay().getheight();
windowmanager wm1 = this.getwindowmanager();方法一與方法二獲取螢幕寬度的方法類似,只是獲取windowmanager 物件時的途徑不同。int width1 = wm1.getdefaultdisplay().getwidth();
int height1 = wm1.getdefaultdisplay().getheight();
方法三:
windowmanager manager = this.getwindowmanager();方法四:displaymetrics outmetrics = new displaymetrics();
manager.getdefaultdisplay().getmetrics(outmetrics);
int width2 = outmetrics.widthpixels;
int height2 = outmetrics.heightpixels;
resources resources = this.getresources();方法三與方法四類似。displaymetrics dm = resources.getdisplaymetrics();
float density1 = dm.density;
int width3 = dm.widthpixels;
int height3 = dm.heightpixels;
Android開發FAQ集錦!!! 不斷更新
答 谷歌官網的 這個被和諧了,經常上不去,中國的網路大家都是 知道的呵呵 2.drawable hdpi,drawable ldpi,drawable mdpi有什麼區別?答 主要是為了支援多解析度的.hdpi裡面主要放高解析度的,如wvga 480x800 fwvga 480x854 mdpi 裡...
Linux環境應用雜記 不斷更新
scim輸入法 sudo apt get remove scim sudo apt get install scim sudo apt get install scim chinese sudo gedit etc x11 xsession.d 95xinput usr bin scim d xmo...
libuv 不斷更新
initialize the uv async t handle.a null callback is allowed.note that uv async init unlike other libuv functions,immediately starts the handle.to stop...