Giter Site home page Giter Site logo

awareviewpager's People

Contributors

hunterstich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

awareviewpager's Issues

Landscape - The fab and header box aren't positioned properly

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.

found a bug

when header hide, then change tabs, scroll down, header will jump.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.