BitmapFactory.Options opts = new BitmapFactory.Options();opts.inPreferredConfig = Bitmap.Config.ARGB_8888;Bitmap b = BitmapFactory.decodeResource(resources,resID,opts);Log.d("test",b.getConfig().toString());
这里resID是jpeg图像资源的ID.
输出为“RGB_565”.
在AndroID 2.2和2.3的模拟器中试过这个.
‘inPreferredConfig’的文档说:
If this is non-null,the decoder will try to decode into this internal
configuration. If it is null,or the request cannot be met,the
decoder will try to pick the best matching config based on the
system’s screen depth,and characteristics of the original image such
as if it has per-pixel Alpha (requiring a config that also does).
Image are loaded with the ARGB_8888 config by default.
那么我打的是“请求无法满足”的情况吗? 总结
以上是内存溢出为你收集整理的android – BitmapFactory.decodeResource()忽略jpg图像的inPreferredConfig选项全部内容,希望文章能够帮你解决android – BitmapFactory.decodeResource()忽略jpg图像的inPreferredConfig选项所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)