У меня есть вид переработчика, который загружает изображение и текст.Когда изображение загружается из URL-адреса, хотя другие элементы Picasso - представление переработчика, теряет свой текст.Элементы, которые теряют свой текст, загружают изображение не из www, а из папки для рисования Android.Все изображения имеют одинаковый размер, и я попробовал это с тем же изображением, и это все еще происходит.Если бы вы могли предоставить какие-либо идеи, потому что я не знаю, что делать или пытаться.
Вот гиф моей проблемы: https://giphy.com/gifs/hR5w7IrCZ14T9M8o7A
--- Редактировать ---- Попытка ответа от Радеш не сработала.Пробовал скользить вместо пикассо (кажется, скольжение намного быстрее).Похоже, проблема заключается в способе обновления утилизатора.
Мой onBindViewHolder
@Override
public void onBindViewHolder(@NonNull final MyViewHolder myViewHolder, int i) {
myViewHolder.textItem.setText(categoryItem.get(i).getEng_name());
if (categoryItem.get(i).getDefault_image().equals("empty") || categoryItem.get(i).getDefault_image().length() == 0) {
Picasso.get().load(R.drawable.no_image).into(myViewHolder.image);
} else {
Glide.with(myViewHolder.context).load("https://i.ibb.co/wwT602t/lake-plastira.jpg").into(myViewHolder.image);
//Picasso.get().load("https://i.ibb.co/wwT602t/lake-plastira.jpg").placeholder(R.drawable.loading_image).error(R.drawable.failed_to_load).into(myViewHolder.image);
}
}
Мой XML для загруженных элементов
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardview_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
app:cardBackgroundColor="?attr/color4">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/item_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:src="@drawable/no_image"
android:scaleType="fitStart" />
<TextView
android:id="@+id/item_name"
android:textColor="?attr/color6"
android:textSize="20sp"
android:gravity="center"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.v7.widget.CardView>
Мой переработчикПросмотреть код
recyclerView = (RecyclerView) findViewById(R.id.categories_rec);
recyclerView.setHasFixedSize(true);
layoutManager = new GridLayoutManager(this, 2);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new SpecificCategoryAdapter(categoryItem);
recyclerView.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();