Glide: Placeholder is not replaced with loaded image, instead image is drawn in top of placeholder

Created on 29 Jul 2018  路  4Comments  路  Source: bumptech/glide

Per doc: When a request completes successfully, the placeholder is replaced with the requested resource.

Actually it's not replaced, but instead it's show bellow the loaded image which causes expensive GPU overdraws, so with placeholder our recyclerview is jerky on low end devices.

            GlideApp.with(context)
                    .load(link)
                    .diskCacheStrategy(NONE)
                    .placeholder(R.color.placeholder)
                    .error(R.color.colorAccent)
                    .centerCrop()
                    .transition(withCrossFade())
                    .into(imageView);
question stale

Most helpful comment

After some research I realized that if I pass

       DrawableTransitionOptions drawableTransitionOptions = new DrawableTransitionOptions().
                crossFade(new DrawableCrossFadeFactory.Builder().
                        setCrossFadeEnabled(true)
                        .build());

to .transition() instead of withCrossFade(), behaviour is different and placeholder is removed after cross fade is finished.
Why default behaviour is not like that?
Is it safe to assume that with code like this performance will be better because of less overdraws or removing placeholder is more expensive?

All 4 comments

After some research I realized that if I pass

       DrawableTransitionOptions drawableTransitionOptions = new DrawableTransitionOptions().
                crossFade(new DrawableCrossFadeFactory.Builder().
                        setCrossFadeEnabled(true)
                        .build());

to .transition() instead of withCrossFade(), behaviour is different and placeholder is removed after cross fade is finished.
Why default behaviour is not like that?
Is it safe to assume that with code like this performance will be better because of less overdraws or removing placeholder is more expensive?

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

See http://bumptech.github.io/glide/doc/transitions.html#cross-fading-with-placeholders-and-transparent-images

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ncit picture Ncit  路  3Comments

PatrickMA picture PatrickMA  路  3Comments

kenneth2008 picture kenneth2008  路  3Comments

MrFuFuFu picture MrFuFuFu  路  3Comments

billy2271 picture billy2271  路  3Comments