Fix scrolling up beyond normal bound (issue #1574)
Steps to reproduce issue #1574 (closed)
- Launch the app.
- Visit Audio tab.
- Visit another tab (for example, More tab).
- Scroll up all the way to the top.
Expected result is:
Actual result is:
(notice that the 2 buttons SETTINGS and ABOUT half disappeared)
I created a simple Android project to reproduce this excessively scrolled up behavior and I realized that this behavior comes from the CoordinatorLayout itself. Perhaps this is a bug of CoordinatorLayout, or perhaps this is just the way it works.
To solve this problem, I've tried various approaches and finally came up with this workaround: instead of toggling the visibility of TabLayout, we could toggle it's height between 0 and wrap_content.
I have verified that this approach works, both in the Emulator and in a physical phone.