ViewPager inside a ScrollView does not scroll correclty
Further reading has revealed that there are issues with scrolling components inside scrolling components.
One solution is to 'disable' the vertical scrolling of the ScrollView on the area of the contained scrollable component, in my case a ViewPager.
The code for this solution is detailed here (and its simply brilliant!)
ScrollView doesn't scroll in a ViewPager
Rty this
In your ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/userInfoViewPager"
android:layout_width="match_parent"
android:layout_height="0dp" // <- ****
app:layout_constraintBottom_toBottomOf="parent" // <- ****
app:layout_constraintTop_toBottomOf="@id/tablayout"
/>
Then, in fragment xml
<ScrollView
....
android:layout_width="match_parent"
android:layout_height="match_parent" // <- ****
>
<androidx.constraintlayout.widget.ConstraintLayout
android:padding="40dp"
android:id="@+id/userInfoContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" // <- ****
>
viewpager inside scrollview makes fragment not displayed when it should
@AlvaroSantisteban Happy I could help. Struggled with this myself too. It all goes down to understanding how layouts work, more specifically understanding wrap_content and match_parent.
So here's the original solution:
Your ViewPager should have a fixed height, considering it's inside a ScrollView.
Related Topics
How to Create an Android Application in Android Studio That Uses the Google Maps API V2
How to Format Datetime in Flutter
Android View Not Attached to Window Manager
How to Create Tests in Android Studio
How to Pass Multiple Primitive Parameters to Asynctask
Android: How to Check If a Particular Accessibilityservice Is Enabled
Play Sound on Button Click Android
Asynctask and Error Handling on Android
Android: Collapsingtoolbarlayout and Swiperefreshlayout Get Stuck
Creating Viewholders for Listviews with Different Item Layouts
Cannot Launch Avd in Emulator:Qt Library Not Found
Avoid Button Multiple Rapid Clicks
Android SQLite: Update Statement
How to Show Shadow Around the Linearlayout in Android
How to Auto-Start an Android Application
Android Adb Stop Application Command Like "Force-Stop" for Non Rooted Device
Android Camera Intent Saving Image Landscape When Taken Portrait