DisplayMetrics metrics=new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
測量數(shù)據(jù):
DisplayMetrics{density=3.0, width=1080, height=1920, scaledDensity=3.0, xdpi=391.885, ydpi=381.0} 型號:小米 Redmi Note3
DisplayMetrics{density=1.3312501, width=1280, height=736, scaledDensity=1.3312501, xdpi=188.148, ydpi=189.023} 型號:Lenovo TB3-850M
DisplayMetrics{density=3.0, width=1080, height=1920, scaledDensity=3.0, xdpi=428.625, ydpi=424.069} 型號:vivo X6SA
分析
DIP (Density Independent Pixel) 妥箕,
參考:
https://developer.android.com/guide/practices/screens_support.html