How To Get Several Viewpagers Into A Scrollview?
Solution 1:
There is indeed something fishy with using multiple ViewPager. I am inflating several views, each holding a ViewPager, and only the first ViewPager got populated with data from its adapter. However, if I give each ViewPager an unique id, all of them gets populated.
I have a container whose only child is a ViewPager:
ViewPagerpager= (ViewPager) pagerContainer.getChildAt(0);
pager.setId(i);
where i
is a positive index of a loop.
Solution 2:
The issue is related to by default height of ViewPager as by default it is taking "fill_parent" , which we are not able to reset with "wrap_content". The solution which i found that fixing the height to some hard code value will return you all the view pager item appear in your screen.
I know this is some fishy solution but it works fine for me and i hope it should work with you.
Solution 3:
On your LinearLayout, in your XML. Set android:weightSum="2"
. For each viewpager, set android:layout_weight="1"
. Also, set the height of each child of the LinearLayout to 0dp. That should do the trick
Post a Comment for "How To Get Several Viewpagers Into A Scrollview?"