需要支持很少的具有800 * 480分辨率和很少的自定义dpi密度的显示器
240、213、210、220。
有没有一种方法可以创建不同的值文件夹,以使xml变暗?
编写代码以检查显示信息,并在设备上获得关于(长,正常)显示信息的奇怪日志结果。 F.e:
信息213dpi
[App:onCreate:164]:SCREENLAYOUT_SIZE_NORMAL,[App:onCreate:181]: SCREENLAYOUT_LONG_YES,[App:onCreate:201]:dpi分类:213, xDpi:213.0,yDpi:213.0
另一个发射
[App:onCreate:164]:SCREENLAYOUT_SIZE_NORMAL,[App:onCreate:178]: SCREENLAYOUT_LONG_NO,[App:onCreate:201]:dpi分类:213, xDpi:213.0,yDpi:213.0
或240dpi
[App:onCreate:164]:SCREENLAYOUT_SIZE_NORMAL,[App:onCreate:178]: SCREENLAYOUT_LONG_NO,[App:onCreate:201]:dpi分类:240, xDpi:240.0,yDpi:240.0
然后下一次发射
[App:onCreate:164]:SCREENLAYOUT_SIZE_NORMAL,[App:onCreate:181]: SCREENLAYOUT_LONG_YES,[App:onCreate:201]:dpi分类:240, xDpi:240.0,yDpi:240.0
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch(screenSize) {
case Configuration.SCREENLAYOUT_SIZE_LARGE:
Logger.e("SCREENLAYOUT_SIZE_LARGE");
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
Logger.e("SCREENLAYOUT_SIZE_NORMAL");
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
Logger.e("SCREENLAYOUT_SIZE_SMALL");
break;
default:
Logger.e("default screen size+: "+screenSize);
}
int screenLong = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_LONG_MASK;
switch(screenLong) {
case Configuration.SCREENLAYOUT_LONG_NO:
Logger.e("SCREENLAYOUT_LONG_NO");
break;
case Configuration.SCREENLAYOUT_LONG_YES:
Logger.e("SCREENLAYOUT_LONG_YES");
break;
case Configuration.SCREENLAYOUT_LONG_UNDEFINED:
Logger.e("SCREENLAYOUT_LONG_UNDEFINED");
break;
default:
Logger.e("screenLong : "+screenLong);
}
DisplayMetrics dm = new DisplayMetrics();
((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(dm);
int dpiClassification = dm.densityDpi;
float xDpi = dm.xdpi;
float yDpi = dm.ydpi;
Logger.e("dpiClassification: "+dpiClassification+", xDpi: "+xDpi+", yDpi: "+yDpi);