Bitmap bitmap=BitmapFactory.decodeResource(getResources(),R.mipmap.iamchan,null);//将资源文件转化为bitmap Bitmap bitmap2 = ((BitmapDrawable)getResources().getDrawable(R.mipmap.iamchan)).getBitmap();//将资源文件转化为bitmap Bitmap bitmap3=((BitmapDrawable)ContextCompat.getDrawable(this,R.mipmap.iamchan)).getBitmap();//将资源文件转化为bitmap
第二种方法过时