Show and hide Action bar while scrolling view pager content

后端 未结 3 1957
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 08:51

I want to show and hide the action bar /toolbar as the Google Play store app. I am using sliding tabs on top and view pager to show the content of each tab. Here is the screens

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 09:44

    Have a look at this:

    https://github.com/flavienlaurent/NotBoringActionBar

    There's a trick involved here. You'll need to:

    1. Wrap your layout in a list view
    2. Add a fake header with the same height as your action bar large header
    3. set your action bar overlay to true
    4. Translate the real header when the list moves (i.e. when the fake header is scrolled).

    It's a little bit complicated at first but once you understand it, you see how smart and obvious it all is. The link will give you all you need I hope.

    I myself used that link to implement it in my own app and it works great.

提交回复
热议问题