包含屏幕的分辨率 以及 屏幕宽度的最大dp 高度最大dp
TextView text = (TextView)findViewById(R.id.text);
DisplayMetrics dm = new DisplayMetrics();
text.append("getResources().getDisplayMetrics()");
text.append("\n=========================\n");
dm = getResources().getDisplayMetrics();
text.append("density: "+dm.density);
text.append("\n");
text.append("densityDpi: "+dm.densityDpi);
text.append("\n");
text.append("scaledDensity: "+dm.scaledDensity);
text.append("\n");
text.append("[width,height]: ["+dm.widthPixels+","+dm.heightPixels+"]");
text.append("\n");
text.append("xdpi: "+dm.xdpi);
text.append("\n");
text.append("ydpi: "+dm.ydpi);
text.append("\n");
text.append("\n\n");
text.append("getResources().getConfiguration()");
text.append("\n=========================\n");
Configuration conf = getResources().getConfiguration();
text.append("fontScale: "+conf.fontScale);
text.append("\n");
text.append("hardKeyboardHidden: "+conf.hardKeyboardHidden);
text.append("\n");
text.append("keyboard: "+conf.keyboard);
text.append("\n");
text.append("mcc: "+conf.mcc);
text.append("\n");
text.append("mnc: "+conf.mnc);
text.append("\n");
text.append("navigation: "+conf.navigation);
text.append("\n");
text.append("navigationHidden: "+conf.navigationHidden);
text.append("\n");
text.append("orientation: "+conf.orientation);
text.append("\n");
text.append("screenHeightDp: "+conf.screenHeightDp);
text.append("\n");
text.append("screenLayout: "+conf.screenLayout);
text.append("\n");
text.append("screenWidthDp: "+conf.screenWidthDp);
text.append("\n");
text.append("smallestScreenWidthDp: "+conf.smallestScreenWidthDp);
text.append("\n");
text.append("touchscreen: "+conf.touchscreen);
text.append("\n");
text.append("uiMode: "+conf.uiMode);
text.append("\n");
text.append("describeContents: "+conf.describeContents());
text.append("\n");
根据以上参数调整屏幕适配