美文网首页
Mutable and Immutable Bitmap in

Mutable and Immutable Bitmap in

作者: Jegsavnerdeg | 来源:发表于2019-10-21 18:16 被阅读0次

    It's about the same difference as with String vs StringBuilder - String is immutable so you can't change its content (well at least not without any hacks), while for StringBuilder you can change its content.
    类似于String同StringBuffer的区别,String的内容是不可变的,像str+="anythingelse";这种操作看上去改变了String的内容,实际上是创建了一个新的String(str+“anythingelse”)。而StringBuffer是可以直接改变其内容的。
    Set Bitmap mutable or immutable:
    BitmapFactory.Options opt = new BitmapFactory.Options();
    opt.inMutable = true;//true:Mutable false:Immutable default:Immutable
    Bitmap bp = BitmapFactory.decodeResource(getResources(), R.raw.white, opt);

    相关文章

      网友评论

          本文标题:Mutable and Immutable Bitmap in

          本文链接:https://www.haomeiwen.com/subject/cigtvctx.html