I am trying to achieve an effect like WhatsApp has, where the Toolbar (when scrolled) will clip into view magnetlike, or out of view magnetlike.
What I have im my MainActivity XML:
- DrawerLayout - Base Layout
- CoordinatorLayout - Layout for the Appbar and Toolbar and Tabs
- AppBarLayout - For holding Toolbar and Tabs
- Toolbar - has THIS flag:
app:layout_scrollFlags="scroll|enterAlways"
- SlidingTabLayout - Displays tabs
- ViewPager - For tabs
- RecyclerView - For coordinatorlayout
Now dont get me wrong, it works, when I scroll down the toolbar gets pushed out of view but say I stop scrolling halfway, then the toolbar just sits there half hidden out of view and the other half in view..
How can I approach solving this problem, as I want it to either snap out of view or into view.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…