How implement sticky footer in recyclerview

后端 未结 8 1943
时光说笑
时光说笑 2021-02-04 02:52

I have RecyclerView and I need next behavior:

  • if there are a lot of items (more then fits screen) - footer is last item
  • if few item/no item - footer is lo
8条回答
  •  忘掉有多难
    2021-02-04 03:17

    All these solutions don't work. When you minimize app and open it again, footer flies lower than the bottom of the screen and you need to scroll to see it, even if there are just 1-2 items. You can add footer view below your recycler view in xml.

    
    
    
    
    
        
    
            
    
            
    
            
    
                
            
        
    
    

    pay attention - I used NestedScrollView with

        recyclerView.isNestedScrollingEnabled = false
    

    and SpaceView has weight 1 and height = 0dp and all this stuff inside of linear layout and NestedScrollView has height = match_parent, now I have footer stuck to the bottom and it is moving further when list become larger

提交回复
热议问题