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.

3
  • Show us a case that it didnt worked. Commented Nov 15, 2017 at 16:53
  • The above is not working. Picture Top is image view, bot are 2 fragments which i enter by swiping right / left. I cannot scroll down in picture. Commented Nov 15, 2017 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 Commented Nov 15, 2017 at 21:56

1 Answer 1

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"> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.