0

My layout file:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">

    <LinearLayout
        android:id="@+id/root_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >


        <ImageView
            android:id="@+id/imageViewPage"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:src="@drawable/zelenjavne_jedi"/>


        <android.support.v4.view.ViewPager
            android:id="@+id/viewpager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.design.widget.TabLayout
                android:id="@+id/sliding_tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

        </android.support.v4.view.ViewPager>

    </LinearLayout>

</ScrollView>

No matter how I change height to fill_parents, wrap_content, match_parent etc, if I use other views such as Relative instead of Linear it still doesn't work.

jm18457
  • 443
  • 1
  • 7
  • 19
  • Show us a case that it didnt worked. – Marcos Vasconcelos Nov 15 '17 at 16:53
  • The above is not working. [Picture](https://drive.google.com/file/d/1i9G2QMNm-boYBvx462R8ehQODwoLssn0/view?usp=sharing) Top is image view, bot are 2 fragments which i enter by swiping right / left. I cannot scroll down in picture. – jm18457 Nov 15 '17 at 17:27
  • WrapContent will wrap the content of the viewpager, not sure if it calculates after ou add views, but in your case, maybe the ImageView could be out of scroll and you add the viewpager directly, since it already have scroll – Marcos Vasconcelos Nov 15 '17 at 21:56

1 Answers1

0

Solution found here

Have to set layout_height attribute to dp value such as this:

<android.support.v4.view.ViewPager
            android:id="@+id/viewpager"
            android:layout_width="match_parent"
            android:layout_height="500dp">
jm18457
  • 443
  • 1
  • 7
  • 19