hopefully I do not re-ask this question. If yes, please give me the other answer.
But now I go to my problem.
I am using an TabLayout with exactly 10 TabItems. Now I wish to swipe between them. Each TabItem do NOT contain a specific view or fragment. Underneath the tabItems is ONE recyclerView, whose elements changes depending on the active tabItem.
Connecting a viewPager2 with a tablayout is like following:
TabLayoutMediator(tablayout, viewpager) { tab, position -> }.attach()
But just that, gives me the error
TabLayoutMediator attached before ViewPager2 has an adapter
I have no idea, how that adapter has to look like. According to the docs, the adapter is nearly equal to a recyclerview.adapter .
May someone teach me the way?
Edit:
I am stucking while creating an adapter WITHOUT an View. The function onCreateViewHolder
returns a RecyclerView.ViewHolder(View)
but I do not have a view. I just have one RecyclerView with an working Adapter which differs on the selected TabItem. The ViewPager2 just has to make it possible to swipe. Not more. Thats why I am overasked, why to have an adapter?
Help appreciated. Padder