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

kooeasy picture kooeasy  路  3Comments

sergeyfitis picture sergeyfitis  路  3Comments

FooBarBacon picture FooBarBacon  路  3Comments

r4m1n picture r4m1n  路  3Comments

Anton111111 picture Anton111111  路  3Comments