1、R-Drawable
1 Resources resources = mContext.getResources();2 Drawable drawable = resources.getDrawable(R.drawable.a);3 imageview.setBackground(drawable);
2、R-Bitmap
Resources r = this.getContext().getResources(); InputStream is = r.openRawResource(R.drawable.my_background_image); BitmapDrawable bmpDraw = new BitmapDrawable(is); Bitmap bmp = bmpDraw.getBitmap();
3、R-Bitmap
Bitmap bmp = BitmapFactory.decodeResource(r, R.drawable.icon);Bitmap newb = Bitmap.createBitmap( 300, 300, Config.ARGB_8888 );
4、R-Bitmap
InputStream is = getResources().openRawResource(R.drawable.icon);
Bitmap mBitmap = BitmapFactory.decodeStream(is);