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``