I am using:
- An
activity
layout containingfragment
added programmatically. - Parent fragment has
FragmentStatePagerAdapter
with view pager, This all content is insideScrollView
. - View pager is filled with some child fragments which has Recyclerview.
Issues are:
- View pager fragment has a list, so I have to programmatically set parent view pager height. But I can't do that.
For that, I have used
viewpager.getLayoutParams().height = 20000;
viewpager.requestLayout();`
and
ViewGroup.LayoutParams params = viewPagerBottom.getLayoutParams();
params.height = 20000;
viewPagerBottom.setLayoutParams(params);
Also, I have tried view pager and view pager fragments height property as wrap_content
- Can't see view pager content if i dont set scrollview
android:layout_height="match_parent"
withandroid:fillViewport="true"
.
It is parent fragment layout.xml.
<ScrollView
style="@style/scrollDefaultStyle"
android:layout_height="wrap_content"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TabLayout .... />
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</ScrollView>