You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having a weird issue
The RecyclerView Doesn't show for the first time when activity is open
But when i open the side menu (which is done in motionLayout) RecyclerView show up..
@SuppressLint("ClickableViewAccessibility")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.rvSmallList.setOrientation(DSVOrientation.HORIZONTAL)
binding.rvSmallList.setOffscreenItems(2)
binding.rvSmallList.setOverScrollEnabled(false)
binding.rvSmallList.setSlideOnFling(true)
binding.rvSmallList.setSlideOnFlingThreshold(2100)
binding.rvSmallList.setItemTransformer(ScaleTransformer.Builder()
.setMaxScale(1f)
.setMinScale(0.9f)
.setPivotX(Pivot.X.CENTER) // CENTER is a default one
.setPivotY(Pivot.Y.CENTER) // CENTER is a default one
.build())
binding.rvSmallList.adapter = VenueAdapter(vm.venueListSmall)
}
adapter is pretty standard
class VenueAdapter(private val items: MutableList<VenueItem> = ArrayList()) RecyclerView.Adapter<VenueAdapter.ItemViewHolder>() {
fun updateList(items: MutableList<VenueItem>) {
this.items.clear()
this.items.addAll(items)
notifyDataSetChanged()
}
override fun getItemCount() = items.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
return ItemViewHolder(VenueItemSmallBinding.inflate(LayoutInflater.from(parent.context), parent, false)
)
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
holder.bind(getItem(position))
}
private fun getItem(position: Int) = items[position]
inner class ItemViewHolder internal constructor(private val binding: VenueItemSmallBinding) :
RecyclerView.ViewHolder(binding.root) {
val vm = VenueItemViewModel()
init {
binding.vm = vm
binding.executePendingBindings()
}
internal fun bind(item: VenueItem) {
// vm.venueItem.set(item)
// binding.executePendingBindings()
}
}
}
The text was updated successfully, but these errors were encountered:
I am having the same issue. The onItemChangedListener works perfectly fine when you swipe on the screen but the view doesn't show. I also tried setting visibility in code but still, it doesn't show.
Having a weird issue
The RecyclerView Doesn't show for the first time when activity is open
But when i open the side menu (which is done in motionLayout) RecyclerView show up..
ItemView is this
`
`
Inside fragment
adapter is pretty standard
The text was updated successfully, but these errors were encountered: