Collapsing Toolbar only for one Fragment in Navigation View

前端 未结 5 1017
天命终不由人
天命终不由人 2021-01-02 03:47

The Problem

I have a navigation drawer with different fragments. There is a default toolbar every Fragment should use, except of one Fragment

5条回答
  •  悲&欢浪女
    2021-01-02 04:03

    It seems you want to achieve something like this.

    I have made an activity with common toolbar. when switching to the collapsing toolbar fragment I've made the toolbar transparent and fragment's toolbar takes over. The toolbar's color remains the same on switching to other fragments.

    This allows you to manage complete collapsing toolbar's layout structure in xml and logic remains in Fragment.

    Hope this will help. Refer the gif linked.

    Gist for gif

提交回复
热议问题