How does Twitter app implement their smooth scrolling with TabLayout
that pins at the top?
I have tried the various combination of CoordinatorLayout
, AppBarLayout
, CollapsingToolbarLayout
, and TabLayout
/ViewPager
. The closest I have is the following hierarchy.
<CoordinatorLayout>
<AppbarLayout>
<CollapsingToolbarLayout layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView />
<LinearLayout />
<Toolbar layout_collapseMode="pin" />
</CollapsingToolbarLayout >
</AppbarLayout>
<LinearLayout layout_behavior="@string/appbar_scrolling_view_behavior">
<TabLayout />
<ViewPager />
</LinearLayout>
There are 2 problems I am trying to solve.
1 - Sometimes fling gesture gets bounced and applied to the opposite direction.
2 - I want one fling to scroll smoothly to the top and bottom. Currently, one fling to the top will once pause at TabLayout
. Then I need to pull/fling up to reach the very top of the screen.
I am aware of this known bug with fling gesture in support library, but Twitter doesn't seem to have this bug. https://code.google.com/p/android/issues/detail?id=176589
[Edit] I have looked at these questions.