Glide: Glide placeholder image retain if transition is used, but disappear when transition not used

Created on 13 Apr 2018  路  5Comments  路  Source: bumptech/glide


Glide Version:4.6.1


Integration libraries:No


Device/Android Version:Android 7.1.1 (API 25)


Issue details / Repro steps / Use case background:
As per https://stackoverflow.com/questions/49817432/glide-placeholder-image-retain-if-transition-is-used-but-disappear-when-transit


Glide load line / GlideModule (if any) / list Adapter code (if any):

    Glide.with(this)
            .load("https://flybubble.com/media/wysiwyg/images/home/mainpage-box-5L.jpg")
            .transition(DrawableTransitionOptions.withCrossFade())
            .apply(RequestOptions()
                    .placeholder(R.drawable.placeholder)
                    .centerCrop()
                    .transforms(CenterCrop(), RoundedCorners(1000)))
            .into(my_image_view)

Will show the placeholder background after the image loaded

    Glide.with(this)
            .load("https://flybubble.com/media/wysiwyg/images/home/mainpage-box-5L.jpg")
            .apply(RequestOptions()
                    .placeholder(R.drawable.placeholder)
                    .centerCrop()
                    .transforms(CenterCrop(), RoundedCorners(1000)))
            .into(my_image_view)

Will not show the placeholder background after the image loaded


Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.elyeproj.demoglide.MainActivity">

    <ImageView
        android:id="@+id/my_image_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>


Stack trace / LogCat:

paste stack trace and/or log here


screen shot 2018-04-13 at 10 43 41 pm
Image where the placeholder (black gradient) is clearly seen after image loaded (where we use transition)
screen shot 2018-04-13 at 10 43 07 pm
Image where the placeholder (black gradient) is no longer seen after image loaded (where we don't use transition)

question stale

All 5 comments

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.

@sjudd From the link you pasted, "If you are loading transparent images with placeholders, you can enable cross fades by adjusting the options in DrawableCrossFadeFactory and passing the result into transition().". The doc suggests to enable transition, but problem here occurs when transition is enabled and does not occur when transition is disabled.

any updates on this @elye @sjudd @hqzxzwb?

I'm not sure what more I can offer here, there's a multiple paragraph explanation in thee doc linked above.

Or are you saying that (from the doc link above) setting cross fade enabled doesn't work either:

DrawableCrossFadeFactory factory =
        new DrawableCrossFadeFactory.Builder().setCrossFadeEnabled(true).build();

GlideApp.with(context)
        .load(url)
        .transition(withCrossFade(factory))
        .into(imageView);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kooeasy picture kooeasy  路  3Comments

sergeyfitis picture sergeyfitis  路  3Comments

billy2271 picture billy2271  路  3Comments

Ncit picture Ncit  路  3Comments

PatrickMA picture PatrickMA  路  3Comments