Android: pin TabLayout to top of Scrollview

后端 未结 3 445
天涯浪人
天涯浪人 2020-12-24 07:58

I was looking at the twitter app on my phone.

You can see that when a user scrolls up, the tabLayout actually just pins itself onto the bottom of the toolba

3条回答
  •  天涯浪人
    2020-12-24 08:13

    for those first 3 questions look here (link seems dead) so this wayback machine link. it points to a github demo repo at https://github.com/slidenerd/Android-Design-Support-Library-Demo

    As for the 4th you need to create fragments for each tab and load them when they are selected for a simple approach, or you can create one fragment and communicate with it to show specific content when a tab is selected..

    EDIT couldn't find an updated link so here are the answers

    1. Use CoordinaterLayout.
    2. Any thing you want to collapse (or hide) with tool bar goes inside collapsingToolBarLayout.
    3. Any thing that stays after collapsed toolBar goes inside of AppBarLayout after CollapsingToolbarLayout.

    ex -

    
    
        
    
            
    
                
    
                
             
            
    
          
    
        
    
        
    
            
        
    
        
    
    

提交回复
热议问题