本文地址:http://blog.csdn.net/caroline_wendy
DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int widthPixels= dm.widthPixels; int heightPixels= dm.heightPixels; float density = dm.density; float dpi = dm.densityDpi; float screenWidth = widthPixels * density; float screenHeight = heightPixels * density; Log.d(TAG, "屏幕宽度: " + screenWidth); Log.d(TAG, "屏幕高度: " + screenHeight); Log.d(TAG, "屏幕密度: " + density); Log.d(TAG, "屏幕DPI: " + dpi);
values-sw1080dp
原文:http://blog.csdn.net/caroline_wendy/article/details/43635007