IvImage . setImageBitmap(creatBitmap(this,R.raw.hai));
public Bitmap creatBitmap (Context context,intresId){
BitmapFactory.Options options = newBitmapFactory.Options();
options . inPreferredConfig= Bitmap.Config.RGB_565;
options . inPurgeable=true;
options . inInputShareable=true;
//获取资源图片
InputStream inputStream = context . getResources().openRawResource(resId);
returnBitmapFactory . decodeStream(inputStream,null,options);
}