Android - SwipeRefreshLayout with empty textview

后端 未结 15 1410
悲哀的现实
悲哀的现实 2020-12-05 02:06

I\'ve implemented SwipeRefreshLayout into my app but it can only hold one direct child which should be the listview. I\'m trying to figure out how to add an emp

15条回答
  •  一生所求
    2020-12-05 03:04

    Here's what I did : I disabled the swipe to refresh, unless my listView is up.

    mBookedProductsListView.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView absListView, int i) {
            }
            @Override
            public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount,     int totalItemCount) {
                if (firstVisibleItem == 0)
                    mSwipeRefreshLayout.setEnabled(true);
                else
                    mSwipeRefreshLayout.setEnabled(false);
            }
        });
    

    My Xml :

    
    
    
    
    
    
        
    
        
    
        
    
    
    
    
    

    Works like a charm.

提交回复
热议问题