问题描述
我使用Glide在RecyclerView中加载图像。经过一些拖放操作后,一些消失的图像会随机出现。我认为拖放侦听器中的setVisibility v_item_src.setVisibility(View.VISIBLE);
代码不可能打开这些遥远项的可见性。可能是什么问题?
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/item_img"
android:visibility="gone"
android:layout_width="34dp"
android:layout_height="34dp"
android:scaleType="centerCrop"
android:src="@drawable/cat_pomelo_head"/>
<TextView
android:id="@+id/item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="Folder Name" />
</LinearLayout>
在拖放侦听器中,我使用
case DragEvent.ACTION_DRAG_ENDED:
view.invalidate();
if (dragEvent.getResult()) {
Toast.makeText(mContext,"The drop was handled.",Toast.LENGTH_SHORT).show();
} else{
Toast.makeText(mContext,"The drop didn't work.",Toast.LENGTH_SHORT).show();
final View v2_src = (View) dragEvent.getLocalState();
v2_src.post(new Runnable(){
@Override
public void run() {
v2_src.setVisibility(View.VISIBLE);
}
});
}
return true ;
我使用
将图像加载到适配器中 Glide.with(mContext)
.load("")
.apply(new RequestOptions().placeholder(R.drawable.cat_pomelo_head).centerCrop()
.dontAnimate().dontTransform())
.into(itemViewHolder.itemImg);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)