滑翔 - 什么是" isImagePosition(位置)"在他们的文件?

时间:2018-05-30 06:26:50

标签: android android-recyclerview android-glide

我试图在我的RecyclerView中使用Glide,而且我对他们在文档中使用的代码有疑问。代码如下所示:

public void onBindViewHolder(ViewHolder holder, int position) {
    if (isImagePosition(position)) {
        String url = urls.get(position);
        Glide.with(fragment)
            .load(url)
            .into(holder.imageView);
    } else {
        Glide.with(fragment).clear(holder.imageView);
        holder.imageView.setImageDrawable(specialDrawable);
    }
}

我不能得到的是#34; isImagePosition(position)"。这是什么?这是否检查在RecyclerView的数据集更新时是否将相同的视图加载到同一位置?如果是这种情况,我将如何实施" isImagePosition(position)"?

我的回收站视图使用List ImageUrl。

1 个答案:

答案 0 :(得分:-1)

如果您使用recyclerView,则可以在方法::

中调用它
override fun onViewRecycled (holder: RecyclerView.ViewHolder) {
   Glide.with (view.context) .clear (imageview)
   super.onViewRecycled (holder)     
 }
相关问题