Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16030

Can't scroll when using SpannedGridLayoutManager in Recyclerview in Android kotlin

$
0
0

I am using the spannedGridLayoutManager library in android kotlin for recyclerview, but I am having problems. When I filter the list of items obtained from the recyclerview API it cannot be scrolled. Meanwhile, when I don't filter the list from the recyclerview API, it can be scrolled.

This is me code after filtering data in API

Class Adapter:`code snippet

override fun onBindViewHolder(holder: DynamicMenuViewHolder, position: Int) {        with(holder){            with(listDynamicMenu[position]){                binding.descImg.text = this.titleEn                binding.img.load(Constant.IMAGES_URL+this.image)                binding.cardMenu.setOnClickListener { onMenuClick?.invoke(this) }            }        }    }    @SuppressLint("NotifyDataSetChanged")    fun add(newMenu: List<SubmenuItem?>?){        newMenu?.let {            //val filteredMenu = it.filterNot { it?.link == "hotel_guide" } // List<SubmenuItem?>            val filteredMenuNonNull = it.filterNotNull()            listDynamicMenu.apply {                clear()                addAll(filteredMenuNonNull)                notifyDataSetChanged()            }        }    }`**detail code**

Detail code adapter and fragmentAdapter

Class Fragment :Fragment

help me please, thanks u``


Viewing all articles
Browse latest Browse all 16030

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>