设置背景禁止在rootview中设置图片作为背景,
尽量放在一个子空间imageview中设置图片,
使用pngcrush IOS的XCODE自带,android需要自己来压缩,效果非常好
/**
* 以最省内存的方式读取本地资源的图片
* @param context
*@param resId
* @return
*/
public static Bitmap readBitMap(Context context, int resId){
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.RGB_565;
opt.inPurgeable = true;
opt.inInputShareable = true;
//获取资源图片
InputStream is = context.getResources().openRawResource(resId);
return BitmapFactory.decodeStream(is,null,opt);
}
取得bitmap之后,再 detailView.setImageBitmap(pdfImage); 就ok了!