Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to touch the ViewPager inside CollapsingToolbarLayout and scroll it? #155

Open
ssung99 opened this issue Oct 24, 2016 · 3 comments

Comments

@ssung99
Copy link

ssung99 commented Oct 24, 2016

I want to touch ViewPager inside CollapsingToolbarLayout, vertical scroll
Please help me

It is my .xml file

<android.support.design.widget.CoordinatorLayout
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:fitsSystemWindows="true">

<me.henrytao.smoothappbarlayout.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
  ...
</me.henrytao.smoothappbarlayout.widget.NestedScrollView>

<me.henrytao.smoothappbarlayout.SmoothAppBarLayout
    android:layout_width="match_parent"
    android:layout_height="400dp">
    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        app:layout_collapseParallaxMultiplier="0.7"
        app:contentScrim="@color/white">
        <ViewPager
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_collapseMode="parallax"
            app:layout_collapseParallaxMultiplier="0.7"/>
    </android.support.design.widget.CollapsingToolbarLayout>
</me.henrytao.smoothappbarlayout.SmoothAppBarLayout>

...

</android.support.design.widget.CoordinatorLayout>

@henrytao-me
Copy link
Owner

Hi @ssung99

Unfortunately, it's not possible right now. People is counting on this issue but I haven't found the solution yet. Sorry.

Cheers,
Henry

@ssung99
Copy link
Author

ssung99 commented Oct 25, 2016

I understood.
Thank you for answering @henrytao-me

@KevinLeigh
Copy link

It is possible to have a view pager in collapsing toolbar layout with both collapsing toolbar layout and view pager scrolling functionality to work properly, below I have the following view hierarchy:

 <CoordinatorLayout>
      <AppBarLayout>
          <CollapsingToolbarLayout>
               <FrameLayout>
                    <ViewPager id="@+id/viewPager"/>
                    <View id="@+id/interceptView"/>
                </FrameLayout>
          </CollapsingToolbarLayout>
     </AppBarLayout>
</CoordinatorLayout>

And then the code is:

View viewPager = findViewById(R.id.viewPager);
findViewById(R.id.interceptView).setOnTouchListener((v, event) -> {
    viewPager.onTouchEvent(event);
    return true;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants