Expanding And Collapsing Toolbar In Android

后端 未结 4 752
遇见更好的自我
遇见更好的自我 2020-12-14 12:55

I am implementing expanding and collapsing toolbar with the help of collapsing toolbar but I am stuck when my toolbar is collapsed I want to show different toolbar. I have s

4条回答
  •  囚心锁ツ
    2020-12-14 13:21

    To achieve this, we must have to create custom behavior using CoordinatorLayout.Behavior

    Take into account two core elements: child and dependency:

    The child is the view that enhances behavior, dependency who will serve as a trigger to interact with the child element. In your requirement the child is the ImageView and the dependency is the Toolbar, in that way, if the Toolbar moves, the ImageView will move too.

    Please check some below links for custome behaviour toolbar demos

    • http://www.devexchanges.info/2016/03/android-tip-custom-coordinatorlayout.html
    • https://medium.com/google-developers/intercepting-everything-with-coordinatorlayout-behaviors-8c6adc140c26#.tfsd7ftkl

提交回复
热议问题