hunterstich / awareviewpager Goto Github PK
View Code? Open in Web Editor NEWA ViewPager with a parallax header, transforming toolbar and tabs
A ViewPager with a parallax header, transforming toolbar and tabs
The issue causing both errors (the fab and transparent bar) had to do with the header_box RelativeLayout. The layout was set to have a height of 375dp. When the screen was rotated, the actual screen height was less than 375dp and the header_box layout height was being shrunk.
Since both the fab positioning and the RecyclerView's header placeholder were using that 375dp to position/set themselves, it caused a gap equal to the difference between the screen size and 375dp. To fix it, I've added a setHeaderHeight() step which runs in onCreate and checks for screen height and sets a variable equal to the appropriate header height called mHeaderHeight. If the screen height is less than the default 375, the header_box is reset to the height of the screen - a small offset. The fab now uses mHeaderHeight to position itself, which fixed it.
For the RecyclerView, there is now a method in the main activity called getHeaderHeight(). When a fragment creates a new adapter for its RecyclerView, it retrieves the value of mHeaderHeight from the main activity.
The only caveat with the solution I've used is that it isn't possible use a header_box that has a height larger than the screen size. This might become an issue if you wanted to modify the contents of the title box which would make it taller. For example, a short paragraph (a short description of Finsteraarhorn in the examples case).
I originally tried to solve the issue by stopping header_box from clipping to the size of the screen, but couldn't get it to work. A whole restructuring of the header_box might be a good idea for more flexibility.
when header hide, then change tabs, scroll down, header will jump.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.