Android SwipeRefreshLayout with empty TextView not working properly

后端 未结 4 1630
旧巷少年郎
旧巷少年郎 2021-01-12 08:36

What i want to do is , allow user to swipe and refresh the list, it does not matter if the data is there or not. But when data is there in the listview only the listview sho

4条回答
  •  没有蜡笔的小新
    2021-01-12 08:53

    I had this issue too, and solved it without any additional code in the activity by using the layout below.

    If you are using a ListActivity or ListFragment it handles showing/hiding the empty view for you, and refreshing works with an empty list as well with this layout structure.

    No hacks needed, everything is in the SwipeRefreshLayout, as it should be.

    
    
        
            
            
                
            
        
    
    

    Hope it helps anyone struggling with this issue.

提交回复
热议问题