在Android 2.3.4上无法获得屏幕尺寸? [英] Can't get screen size on Android 2.3.4?
本文介绍了在Android 2.3.4上无法获得屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Android 2.3.4手机上执行此功能:
Executing this function on Android 2.3.4 Phone:
public void GetScreenSize(){
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
width = size.x;
height = size.y;
}
width = 0,height = 0为什么?请帮忙。
P.S.在Android 4.0.4平板电脑上它完美无缺。
推荐答案
display.getSize [ ^ ]在API级别13中添加,Android 2.3.4使用API级别 [ ^ ] 10.
使用 Build.VERSION [ ^ ]类,了解支持哪个API级别以及如何进行后续操作即显示尺寸。
The display.getSize[^] was added in API level 13 and Android 2.3.4 uses API level[^] 10.
Use the Build.VERSION[^] class to see which API level is supported and how you should retrieve the display size.
这篇关于在Android 2.3.4上无法获得屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文