• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Viewport doesn't work with Scrollview

RioLeal

Newbie
Hi,
My app works fine and no errors in portrait view but I need Scroll the screen in Landscape view.

My XML File seems like this:
HTML:
<ScrollView>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <com.google.android.material.tabs.TabLayout>
            <com.google.android.material.tabs.TabItem /> // TabItem 1
            <com.google.android.material.tabs.TabItem /> // TabItem 2
        </com.google.android.material.tabs.TabLayout>
        <androidx.viewpager.widget.ViewPager /> //ViewPager Without TabLayout and all basic configurations
    </LinearLayout>
</ScrolView>

So, I'm not getting make Scroll works in LandScape view or when have too many components in Portrait view.
Remembering that code is working fine, but I need implement the scroll with ViewPager.
Thanks
 
I figured out!
I've changed the Constraint to RelativeLayout in XML, so worked fine to me.

HTML:
<RelativeLayout> <!-- Here was Constraint. Now RelativeLayout -->
    <ScrollView>
        <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:orientation="vertical">
            <com.google.android.material.tabs.TabLayout>
                <com.google.android.material.tabs.TabItem /> <!-- TabItem 1 -->
                <com.google.android.material.tabs.TabItem /> <!-- TabItem 2 -->
            </com.google.android.material.tabs.TabLayout>

            <androidx.viewpager.widget.ViewPager /> <!-- ViewPager Without TabLayout and all basic configurations -->
        </LinearLayout>
    </ScrolView>
</RelativeLayout>
 
I have no clue what that means, but congrats on figuring it out. :thumbsupdroid: I often find asking out loud makes me think things through in a different way.
 
Back
Top Bottom