Android nestedScrollview And ViewPager not working together

Viewed 5393

I am developing an app which has a viewPager and it should scroll

enter image description here

   <android.support.v4.widget.NestedScrollView
        android:id="@+id/activity_main_nestedscrollview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.v4.view.ViewPager
            android:id="@+id/activity_main_viewpager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#FFA0"/>


    </android.support.v4.widget.NestedScrollView>

but viewPager is not visible if i use above code

2 Answers

I am too late to answer this but I face the same problem.

First Solution To solve this problem is to give fix height to viewpager.

Second Solution Use CollapsingToolbarLayout and redesign layout according to CollapsingToolbarLayout

Related