why doesn't spancount work and glide size can't change

Viewed 37

I want to change the spancount to 2 but the default spancount is 1, I've also tried changing the glide size but nothing has changed. and when run, the spancount will only remain one but the layout has become 2. please help, I really need this thank you

this is code adapter

class MakeUpAdapter (private val clickListener : OnClickListener): 
RecyclerView.Adapter<MakeUpAdapter.MakeUpViewHolder>(){


private val data = ArrayList<MakeUpModel>()

inner class MakeUpViewHolder (itemView: View) : 
RecyclerView.ViewHolder(itemView){


    fun bind(data: MakeUpModel) {
        //lib3
        Glide.with(itemView.context)
            .load(data.Picture)
            .apply(
                RequestOptions()
                    .override(100, )
            )
            .into(itemView.iv_item)


        itemView.tv_Name.text = data.Name
        itemView.tv_price.text = data.Price.toString()

    }

}



override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): 
MakeUpViewHolder {
    val view: View =
        
LayoutInflater.from(parent.context).inflate(R.layout.item_makeup, 
parent, false)
    return MakeUpViewHolder(view)
}


interface OnClickListener{
    fun detail(item: Int)
}



override fun onBindViewHolder(holder: MakeUpViewHolder, position: 
Int) {
    holder.bind(data[position])
    holder.itemView.setOnClickListener {
        clickListener.detail(position)
    }

}

override fun getItemCount(): Int = data.size


@SuppressLint("NotifyDataSetChanged")

fun setData(list: ArrayList<MakeUpModel>) {
    data.clear()
    data.addAll(list)
    notifyDataSetChanged()
}

this is code xml, i wrapped recyclerview inside scroll view

<androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv_kamu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="370dp"
  app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
        app:spanCount="2"
        tools:listitem="@layout/item_makeup" />
    

and this is the debug from logcat

com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: 403) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed There was 1 root cause: com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: 403) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: 403 2022-09-24 09:09:50.716 4784-4784/com.slowmotion.makeup2app I/Glide: Root cause (1 of 1)

0 Answers
Related