清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
import android.app.Activity; import android.util.DisplayMetrics; public class Screen { private Screen(){ } public static float getDensity(Activity active) { DisplayMetrics dm = active.getResources().getDisplayMetrics(); return dm.density; } public static int getDensityDPI(Activity active) { DisplayMetrics dm = active.getResources().getDisplayMetrics(); return dm.densityDpi; } public static int getScreenWidth(Activity active) { DisplayMetrics dm = active.getResources().getDisplayMetrics(); return dm.widthPixels; } public static int getScreenHeight(Activity active) { DisplayMetrics dm = active.getResources().getDisplayMetrics(); return dm.heightPixels; } }