I am trying to use ViewPager2 with Tablayout inside a Fragment. It does not show recyclerview when I keep it inside a Scrollview, whereas if I keep the ViewPager2 outside a Scrollview it works perfectly fine. Please help if anyone faced similar problem or have any idea about this?
I have two different layouts that I want under Scrolling. One layout has ViewPager and other is simple layout with Views.
Tried using NestedScrollview with fillViewport=true and setnestedscrollingenabled to true. It didnt work
Kindly please provide your suggestions how to achieve this?
CodePudding user response:
I think there is an issue because your parent layout is ConstraintLayout
and in child layout your didn't give any constraint to ScrollView
.
Once you give constraint to ScrollView like below your layout will be shown.
<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
CodePudding user response:
Thank you for the help. I tried using the NestedScrollView After ScrollView and ViewPager2 inside the NestedScrollView. It worked this way.