ViewPager in a NestedScrollView

前端 未结 19 2144
面向向阳花
面向向阳花 2020-11-27 10:08

I need to create an interface like Google Newsstand which is a sort of ViewPager (horizontal scroll) over a collapsing header (vertical scroll). One of my requirements is to

19条回答
  •  星月不相逢
    2020-11-27 10:44

    Actually the NestedScrollView doesn't need to to be direct sibling of CollapsingToolbarLayout in CoordinatorLayout. I have achieved something realy bizzare. The appbar_scrolling_view_behavior works in 2 nested fragments.

    My activity layout:

    
    
        
    
                
    
                    
    
                
    
        
    
        
    
    
    

    In the "container" frameLayout I have inflated this fragment:

    
    
        ... some content ...
    
        
    
        ...
    
    
    

    And fragments inside that ViewPager looks like this:

    
    
        
    
        ....
    
    
    

    Fact that NestedScrollView can be so deep in the CoordinatorLayout children hierarchy and scroll behaviors stil works did suprised me.

提交回复
热议问题