我如何让 android 模拟器报告特定的屏幕尺寸
我正在尝试模拟 HTC Flyer,为了做到这一点,我需要模拟器自我报告为“大”屏幕尺寸。我已指定分辨率和正确的 dpi,但它报告为“xlarge”。 Android 文档 ( http://developer.android.com/guide/practices/screens_support .html#range )指定它应该是“xlarge”,但 HTC Flyer 设备却说它是“large”。这是一些带有一些数字的调试输出:
flyer device
DisplayMetrics{density=1.0, width=600, height=1024, scaledDensity=1.0, xdpi=169.99738, ydpi=169.33333}, densityDpi, 160, density, 1.0, screen size, large,
flyer emulator
DisplayMetrics{density=1.0, width=600, height=1024, scaledDensity=1.0, xdpi=160.0, ydpi=160.0}, densityDpi, 160, density, 1.0, screen size, xlarge,
注意“屏幕尺寸”。其他一切都相同,但设备报告“large”,模拟器报告“xlarge”。有没有办法让模拟器报告“大”?
这是给我输出的java:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screenLayout = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
String screenLayoutStr;
switch (screenLayout){
case Configuration.SCREENLAYOUT_SIZE_SMALL:
screenLayoutStr = "small";
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
screenLayoutStr = "normal";
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
screenLayoutStr = "large";
break;
case 4:
screenLayoutStr = "xlarge";
break;
default:
screenLayoutStr = "unknown: " + screenLayout;
}
LogIt.d(this,metrics,"densityDpi",metrics.densityDpi,"density",metrics.density,"screen size",screenLayoutStr);
I am trying to emulate the HTC Flyer and in order to do that I need the emulator to self-report as "large" screen size. I have specified the resolution and the correct dpi but it reports as "xlarge". The android documentation ( http://developer.android.com/guide/practices/screens_support.html#range ) specifies that it should be "xlarge" but the HTC Flyer device says it's "large". Here is some debug output with some numbers:
flyer device
DisplayMetrics{density=1.0, width=600, height=1024, scaledDensity=1.0, xdpi=169.99738, ydpi=169.33333}, densityDpi, 160, density, 1.0, screen size, large,
flyer emulator
DisplayMetrics{density=1.0, width=600, height=1024, scaledDensity=1.0, xdpi=160.0, ydpi=160.0}, densityDpi, 160, density, 1.0, screen size, xlarge,
notice the "screen size". Everything else is equal but the device reports "large" and the emulator "xlarge". Is there a way to make the emulator report "large" instead?
Here is the java that gave me the output:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screenLayout = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
String screenLayoutStr;
switch (screenLayout){
case Configuration.SCREENLAYOUT_SIZE_SMALL:
screenLayoutStr = "small";
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
screenLayoutStr = "normal";
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
screenLayoutStr = "large";
break;
case 4:
screenLayoutStr = "xlarge";
break;
default:
screenLayoutStr = "unknown: " + screenLayout;
}
LogIt.d(this,metrics,"densityDpi",metrics.densityDpi,"density",metrics.density,"screen size",screenLayoutStr);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论