android获取资源文件R.drawable中的图片的相关方法
2014-06-03 16:30
639 查看
1.
// 获取资源文件的关键!
Resources resources = mContext.getResources();
Drawable drawable = resources.getDrawable(R.drawable.a);
imageview.setBackground(drawable);
2、
Resources r = this.getContext().getResources();
Inputstream is = r.openRawResource(R.drawable.my_background_image);
BitmapDrawable bmpDraw = new BitmapDrawable(is);
Bitmap bmp = bmpDraw.getBitmap();
3、
Bitmap bmp=BitmapFactory.decodeResource(r, R.drawable.icon);
Bitmap newb = Bitmap.createBitmap( 300, 300, Config.ARGB_8888 );
4、
InputStream is = getResources().openRawResource(R.drawable.icon);
Bitmap mBitmap = BitmapFactory.decodeStream(is);
// 获取资源文件的关键!
Resources resources = mContext.getResources();
Drawable drawable = resources.getDrawable(R.drawable.a);
imageview.setBackground(drawable);
2、
Resources r = this.getContext().getResources();
Inputstream is = r.openRawResource(R.drawable.my_background_image);
BitmapDrawable bmpDraw = new BitmapDrawable(is);
Bitmap bmp = bmpDraw.getBitmap();
3、
Bitmap bmp=BitmapFactory.decodeResource(r, R.drawable.icon);
Bitmap newb = Bitmap.createBitmap( 300, 300, Config.ARGB_8888 );
4、
InputStream is = getResources().openRawResource(R.drawable.icon);
Bitmap mBitmap = BitmapFactory.decodeStream(is);
相关文章推荐
- android 获取资源文件 r.drawable中的图片转换为drawable、bitmap
- android 获取资源文件 r.drawable中的图片转换为drawable、bitmap
- android如何获取res文件夹下drawable文件夹下的图片资源文件转成一个BitMap对象
- Android 获取资源文件 r.drawable中的图片转换为drawable、bitmap
- Android中通过资源文件获取drawable的几种方法
- android 获取资源文件 r.drawable中的图片转换为drawable、bitmap
- android 获取资源文件 R.drawable中的图片转换为drawable、bitmap(转载)
- android 获取资源文件 r.drawable中的图片转换为drawable、bitmap
- android中从values/strings资源文件中获取拼接字符串的方法
- 安卓获取res下的资源文件:string字符串、color颜色、dimen尺寸、array数组、drawable图片和xml、anim/animator动画、raw媒体、assets资源
- URL转Drawable之 Android中获取网络图片的三种方法
- android获取drawable图片的id和名字的方法
- Android中获取资源文件的几种方法
- android 开发之将 R.drawable里面的图片资源转换成Bitmap型的方法小结
- android 利用反射机制获取drawable中所有的图片资源
- URL转Drawable之 Android中获取网络图片的三种方法
- android 图片、文件资源资源相关操…
- URL转Drawable之 Android中获取网络图片的三种方法
- android获取在res文件下的图片资源
- 获取资源文件 r.drawable中的图片转换为drawable、bitmap