سلام خدمت استاد عزیز
من چندین بار از ریسایکلر ویو توی برنامه م استفاده کردم به همون شکلی که آموزش دادید
چیز خاصی هم توی لیست نیست غیر از چندتا متن ویه عکس پروفایل کاربر که از سمت سرور با پیکاسو لود میکنم ولی خیلی از کاربرا میگن که روی گوشیشون رون بالا پایین نمیشه ولگ داره
از کجا میشه دلیلش روفهمید؟ایا کدنویسی ایراد داره؟عکس سنگینی هم که ندارم مشکل میتونه از کجا باشه؟
ممنون از پاسخگوییتون
سلام وقت بخیر، لطفا یه اسکرین شات از کد و اسکرین شات از لیست اپ ارسال کنید
class CodeAdapter(var context: Context, var onCodeItemClick: (id: String?, position: Int) -> Unit) : RecyclerView.Adapter<CodeAdapter.CodeViewHolder>() { var list= mutableListOf<Codes>() override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CodeViewHolder { var view = LayoutInflater.from(parent.context).inflate(R.layout.code_item, parent, false) return CodeViewHolder(view) } fun getPagedList(pagedList: List<Codes>){ list.addAll(pagedList) notifyDataSetChanged() } override fun getItemCount(): Int { return list.size } override fun onBindViewHolder(holder: CodeViewHolder, position: Int) { if (list[position].image != null) { Picasso.get().load(list[position].image).into(holder.image) } else { if (list[position].jensiat == 0) { holder.image.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.man)) } else { holder.image.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.woman)) } } holder.txtTitle.setText(list[position].title) holder.txtText.setText(list[position].text) holder.txtPoint.text = "${list[position].point} رای مثبت " holder.txtDate.setText(" تاریخ : ${list[position].date}") holder.parent.setOnClickListener { onCodeItemClick(list[position].codeId, position) } } class CodeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { var txtTitle = itemView.findViewById<TextView>(R.id.txt_codeItem_title) var txtText = itemView.findViewById<TextView>(R.id.txt_codeItem_text) var txtPoint = itemView.findViewById<TextView>(R.id.txt_codeItem_point) var txtDate = itemView.findViewById<TextView>(R.id.txt_codeItem_date) var parent = itemView.findViewById<RelativeLayout>(R.id.card_codeItem_parent) var image = itemView.findViewById<ImageView>(R.id.img_codeItem_userImage) } }
اینم فایل xml:
<RelativeLayout 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:orientation="vertical" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" android:background="@color/white" android:foreground="?attr/selectableItemBackground" android:id="@+id/card_codeItem_parent" android:layout_width="match_parent" android:layout_height="wrap_content"> <com.mikhaellopez.circularimageview.CircularImageView android:layout_width="100dp" android:layout_alignParentRight="true" android:layout_marginRight="8dp" android:layout_marginTop="8dp" android:layout_height="100dp" android:src="@drawable/woman" app:civ_border_color="@color/colorPrimary" app:civ_border_width="2dp" android:id="@+id/img_codeItem_userImage" app:civ_shadow="true" app:civ_shadow_radius="10" app:civ_shadow_color="@color/white"/> <TextView android:layout_marginLeft="8dp" android:textColor="@color/black" android:gravity="right" android:id="@+id/txt_codeItem_title" android:layout_marginTop="8dp" android:layout_marginRight="4dp" android:maxLines="2" android:ellipsize="end" tools:text="کد بازگشت از برنامه" android:layout_toLeftOf="@id/img_codeItem_userImage" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:layout_marginLeft="8dp" android:textSize="12sp" android:gravity="right" android:id="@+id/txt_codeItem_text" android:maxLines="2" android:ellipsize="end" tools:text="توضیحات در مورد کد " android:layout_marginTop="4dp" android:layout_marginRight="8dp" android:layout_toLeftOf="@id/img_codeItem_userImage" android:layout_below="@id/txt_codeItem_title" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:paddingLeft="8dp" android:paddingRight="8dp" android:textColor="@color/white" android:background="@drawable/shape_point" android:id="@+id/txt_codeItem_point" android:layout_marginTop="4dp" android:layout_marginLeft="8dp" tools:text="120" android:layout_below="@id/txt_codeItem_text" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_marginTop="4dp" android:textSize="12sp" android:id="@+id/txt_codeItem_date" tools:text="تاریخ : 12/12/98" android:paddingBottom="4dp" android:layout_marginLeft="8dp" android:layout_below="@id/txt_codeItem_point" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </RelativeLayout>
عکس از لیست هم پیوست شد که فرمودید منتها این لیست بی نهایت هست که توی اداپتر هم مشخصه استاد
آداپترت مشکلی نداره و همه چی درسته، اون دو تا فایل عکس پروفایل زن و مرد رو از پوشه drawable ببر توی پوشه هایی که پسوند hdpi دارن مثل drawable-xxxhdpi
استاد اتفاقا توی پوشه xxxhdpi گذاشتمشون ولی نمیدونم چرا این مشکل هست
حتی صفحه اول اپ که سه تا ریسایکلر افقی داره ویکی از ریسایکلر ها حتی عکس هم نداره روی نسخه مارشمالو تست کردم یه خورده لگ داشت نمیدونم چی باعثش شده!
توی صفحه اولم دوتا بنر عکس دارم حدود 100 کیلو بایت هر کدوم سایزشونه ولی اینا هم توی پوشه xxxhdpi هستن اینا مشکلی ایجاد نمیکنن؟
دیگه نمیدونم چی رو باید تست کنم
ممنون میشم اگه نکته ای به ذهنتون میرسه بگید