Deslice el disparador OnLoadFailed () después de cargar toda la image después de desplazarse hacia abajo y desplazarse hacia arriba

Tengo la siguiente vista para mostrar el desplazamiento de la image de la marca horizontalmente …

onLoadFail () se dispara cuando me desploop hacia arriba, pero si comento onLoadFail () cada trabajo como esperaba … ¿Qué sucede aquí?

Con onLoadFail ()

// Setup product image Glide.with(context) .load(item.shopImageURL) .into(holder.imgBrand) .onLoadFailed(ContextCompat.getDrawable(context, android.R.drawable.ic_dialog_alert)) 

GIF Link: google drive

Sin onLoadFail ()

  // Setup product image Glide.with(context) .load(item.shopImageURL) .into(holder.imgBrand) 

GIF Link: google drive

LoveBrandView.kt

 class LoveBrandView : LinearLayout { constructor(context: Context?) : super(context) constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) private val adapter = LoveBrandAdapter() init { // Set layout orientation to vertical orientation = VERTICAL setBackgroundColor(Color.parseColor("#262626")) val inflater = LayoutInflater.from(context) inflater.inflate(R.layout.view_home_highlight_brand, this, true) // Attach the adapter to the recyclerview to populate items rcvLoveBrand.adapter = adapter // Set layout manager to position the items rcvLoveBrand.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) // Snap list item after scroll on the gravity start of screen val snapHelperTop = GravitySnapHelper(Gravity.START) snapHelperTop.attachToRecyclerView(rcvLoveBrand) adapter.setListItem(mock()) adapter.notifyDataSetChanged() } fun mock(): MutableList<ShopItem> { val items = mutableListOf<ShopItem>() items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/calvin-klein.jpg")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/brand-logo-9.jpg")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/uniqlo-logo-vector.jpg")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/esprit-logo.jpg")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/b52c51f556c88216c1795f4ca433fd01--product-logo-fashion-logos.jpg")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/Ralph-Lauren-Logo.png")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/956f1edc1ec624cc97301e72c6d5b90e--fashion-logos-fashion-typography.jpg")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/Chanel_Logo.png")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/Paul-Smith-Logo.png")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/Louis-Vuitton-Logo.png")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/53290622f51318026dd537a2a9e7da94.jpg")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/large_slack-imgs.com.png")) items.add(ShopItem(shopImageURL = "http://img.flipandroid.com/android&usg=ALkJrhhOyszGLBIZpB5qdxTiV7wDRGEuog/Intel-Logo.png")) return items } inner class LoveBrandAdapter : RecyclerView.Adapter<LoveBrandAdapter.ViewHolder>() { private var items = mutableListOf<ShopItem>() fun setListItem(newItem: MutableList<ShopItem>) { items = newItem } override fun onBindViewHolder(holder: ViewHolder?, position: Int) { val item = items[position] if (holder != null) { // Setup product image Glide.with(context) .load(item.shopImageURL) .into(holder.imgBrand) .onLoadFailed(ContextCompat.getDrawable(context, android.R.drawable.ic_dialog_alert)) } } override fun getItemCount() = items.size override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { val inflater = LayoutInflater.from(parent?.context) val view = inflater.inflate(R.layout.listitem_home_highlight_brand, parent, false) return ViewHolder(view) } inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { val imgBrand: ImageView = itemView.findViewById(R.id.imgBrand) } } } 

XML

 <merge 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="wrap_content" tools:background="#262626" tools:parentTag="android.widget.LinearLayout" tools:orientation="vertical" tools:context=".ui.home.HomeActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="32dp" android:layout_marginBottom="32dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:orientation="horizontal"> <TextView android:id="@+id/tvTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Brand We Love" android:textAllCaps="true" android:textColor="@color/colorAccent" android:textSize="18sp" android:textStyle="bold" /> <View android:id="@+id/guideline" android:layout_width="match_parent" android:layout_height="0dp" android:layout_alignBaseline="@id/tvTitle" android:layout_gravity="bottom" android:layout_marginLeft="8dp" android:layout_marginStart="8dp" android:layout_toEndOf="@+id/tvTitle" android:layout_toRightOf="@+id/tvTitle" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_above="@+id/guideline" android:layout_gravity="bottom" android:layout_marginLeft="8dp" android:layout_marginStart="8dp" android:layout_toEndOf="@+id/tvTitle" android:layout_toRightOf="@+id/tvTitle" android:background="@color/colorAccent" /> </RelativeLayout> <com.abfabmarket.mobile.abfab.ui.view.CustomRecycleView android:id="@+id/rcvLoveBrand" android:layout_width="match_parent" android:layout_height="150dp" android:layout_marginBottom="32dp" android:orientation="horizontal" app:layoutManager="android.support.v7.widget.LinearLayoutManager" tools:listitem="@layout/listitem_home_highlight_brand" /> </merge> 

Solutions Collecting From Web of "Deslice el disparador OnLoadFailed () después de cargar toda la image después de desplazarse hacia abajo y desplazarse hacia arriba"