private int getNumPhotoReused() {
// 获取屏幕密度(方法)
DisplayMetrics dm = new DisplayMetrics();
dm = context.getResources().getDisplayMetrics();
float density = dm.density; // 屏幕密度(像素比例:0.75/1.0/1.5/2.0)
int densityDPI = dm.densityDpi; // 屏幕密度(每寸像素:120/160/240/320)
float xdpi = dm.xdpi;
float ydpi = dm.ydpi;
Log.e("DisplayMetrics", "xdpi=" + xdpi + "; ydpi=" + ydpi);
Log.e( "DisplayMetrics", "density=" + density + "; densityDPI=" +
densityDPI);
int screenWidth = dm.widthPixels; // 屏幕宽(像素,如:480px)
int screenHeight = dm.heightPixels; // 屏幕高(像素,如:800px)
Log.e("DisplayMetrics(111)", "screenWidth=" + screenWidth +
"; screenHeight=" + screenHeight);
int picWidth = 120;
Log.e("pageNumReused==",String.valueOf(screenWidth /picWidth +3));
return screenWidth ;
}
// 获取屏幕密度(方法)
DisplayMetrics dm = new DisplayMetrics();
dm = context.getResources().getDisplayMetrics();
float density = dm.density; // 屏幕密度(像素比例:0.75/1.0/1.5/2.0)
int densityDPI = dm.densityDpi; // 屏幕密度(每寸像素:120/160/240/320)
float xdpi = dm.xdpi;
float ydpi = dm.ydpi;
Log.e("DisplayMetrics", "xdpi=" + xdpi + "; ydpi=" + ydpi);
Log.e( "DisplayMetrics", "density=" + density + "; densityDPI=" +
densityDPI);
int screenWidth = dm.widthPixels; // 屏幕宽(像素,如:480px)
int screenHeight = dm.heightPixels; // 屏幕高(像素,如:800px)
Log.e("DisplayMetrics(111)", "screenWidth=" + screenWidth +
"; screenHeight=" + screenHeight);
int picWidth = 120;
Log.e("pageNumReused==",String.valueOf(screenWidth /picWidth +3));
return screenWidth ;
}