List activity with header, footer and empty all visible

前端 未结 8 1397
失恋的感觉
失恋的感觉 2021-01-08 00:36

I would like to have the listview in a ListActivity be displayed with the header and footer visible all the time even if the list data is empty.

An empty list causes

8条回答
  •  爱一瞬间的悲伤
    2021-01-08 01:08

    You can put the listView and the empty layout together in a FrameLayout, and put the empty layout margin in the size of the header, then, you can change the visibility of the empty view when an item is added to listview.

    layout will be as similar to this:

    
    
        
    
        
    
           //insert your layout here
    
        
    
    
    

提交回复
热议问题