标签:android style blog color strong width
小方法
1.获取屏幕分辨率:
1 public class BaseTools { 2 3 public static int getWindowWidth(Context context) { 4 // 获取屏幕分辨率 5 WindowManager wm = (WindowManager) (context 6 .getSystemService(Context.WINDOW_SERVICE)); 7 DisplayMetrics dm = new DisplayMetrics(); 8 wm.getDefaultDisplay().getMetrics(dm); 9 int mScreenWidth = dm.widthPixels; 10 return mScreenWidth; 11 } 12 13 public static int getWindowHeigh(Context context) { 14 // 获取屏幕分辨率 15 WindowManager wm = (WindowManager) (context 16 .getSystemService(Context.WINDOW_SERVICE)); 17 DisplayMetrics dm = new DisplayMetrics(); 18 wm.getDefaultDisplay().getMetrics(dm); 19 int mScreenHeigh = dm.heightPixels; 20 return mScreenHeigh; 21 } 22 }
标签:android style blog color strong width
原文地址:http://www.cnblogs.com/liangstudyhome/p/3816839.html