Is there an addHeaderView equivalent for RecyclerView?

后端 未结 19 1631
独厮守ぢ
独厮守ぢ 2020-11-21 23:35

I\'m looking for an equivalent to addHeaderView for a recycler view. Basically I want to have an image with 2 buttons be added as a header to the listview. Is there a differ

19条回答
  •  鱼传尺愫
    2020-11-22 00:22

    You can just place your header and your RecyclerView in a NestedScrollView:

    
    
        
    
            
    
            
    
        
    
    
    

    In order for scrolling to work correctly, you need to disable nested scrolling on your RecyclerView:

    myRecyclerView.setNestedScrollingEnabled(false);
    

提交回复
热议问题