How to use a TabLayout with Toolbar inside CollapsingToolbarLayout?

后端 未结 18 2281
逝去的感伤
逝去的感伤 2020-11-27 11:46

I am looking at the chrisbanes/cheesesquare and I am trying to put TabLayout with a Toolbar inside a CollapsingToolbarLayout, and here is my code



        
18条回答
  •  萌比男神i
    2020-11-27 12:17

    As someone pointed out before, it looks like this is because (from the docs):

    The navigation button is vertically aligned within the Toolbar's minimum height, if set.

    Therefore, based on the initial layout you can do something like this:

    
    
                
    
                 
    
                
    
            
    

    Where app:titleMarginTop is the spacing needed to get the Toolbar size minus TabLayout size minus the text size and it should align nicely.

提交回复
热议问题