How to properly hide&show the actionbar using the new design library API?

后端 未结 3 1097
北海茫月
北海茫月 2020-12-28 15:10

Background

Suppose I have these elements in the activity:

  • actionbar (actually a Toolbar)
  • tabs (using TabLayout )
  • ViewPager, with fr
3条回答
  •  伪装坚强ぢ
    2020-12-28 15:55

    New design API are for new components only. If that component is going to support older versions then it must work for older versions.

    Related to your issue: I don't know, whether you have used the suggested library or not. But it works well here in my case. I know that its a very old library and you must have to use listview with that. You can't implement recyclerview with that. But as i want to have very flexible and smooth effect, I have try it out and it works very well.

    You can also make smooth scroll of toolbar with Listview scrolling and also make paralax effect as you have seen in the example.

    See this images for the effect I have implemented for my app. Mark with red color is my toolbar of the app.

    Image when it is expanded:

    Image when it is collapsed:

    I suggest to try that library for your actionbar related issue, if you do not think to change your listview to recyclerview. But if you want to change your listview to recyclerview then you can use new design API for such effect.

    Let me know if I can help you more in this case.

    Sincerely,

    Shreyash

    Updated answer

    I assume that you need something like THIS.

    If it is what you want, then you should have to refer this library and implement like that.

    Please refer, Part1, Part2 and part3 for similar effect.

    Let me know if you need anything else.

提交回复
热议问题