Skip to content

hello,有一点疑问 #1

@xumengyin

Description

@xumengyin

你好,我做了个实验public BitmapDrawable initBitmap(int drawId) {
BitmapDrawable bd = null;
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
opt.inPurgeable = true;
opt.inInputShareable = true;
InputStream is =getResources()
.openRawResource(drawId);
bd = new BitmapDrawable(getResources(),
BitmapFactory.decodeStream(is, null, opt));
return bd;
}
这是我用网上找到的decodeStream大图的方法,和你的decodestream相比较,前种方法消耗内存更少,而且反复进入加载大图的activity内存似乎更稳定;但是 opt.inPurgeable ;opt.inInputShareable这俩个属性在api21不建议使用了,不知是否能解惑下您的重载decodeStream的用意

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions