2

I want to make a ViewPager in a scrollview, and i know that a viewpager with scroll that's inside a scrollview wont be a good practise. In the case i thought of adapting the height of viewpager to wrap_content, so the size of the scrollview would change depending on the child of the viewpager.

I have found some solutions in here, but it didn't work, and i was wondering if there is anyone that already had found a solution for this. The closest i got to a solution was this, but it only set's the height of the first shown child, and in my case the height of the fragments can vary.

Community
  • 1
  • 1
Ibrahim Yildirim
  • 2,731
  • 2
  • 19
  • 31

1 Answers1

0

Yes. you can. in that solution code

change

View view = getChildAt(0);

to

View view = getChildAt(getCurrentItem());

Community
  • 1
  • 1
devflow
  • 135
  • 2
  • 11