HeaderListView icon indicating copy to clipboard operation
HeaderListView copied to clipboard

Scroll up force SwipeRefreshLayout to refresh

Open tolotrasam opened this issue 8 years ago • 2 comments

Scroll up force SwipeRefreshLayout to refresh, however, scroll down works properlly

tolotrasam avatar Mar 11 '17 20:03 tolotrasam

how I went about this was to add my SwipeRefreshLayout in HeaderListView manually and then add the internal ListView to mySwipeRefreshLayout

...
       mListView.setOnItemClickListener((parent, view, position, id) -> {
            if (mAdapter != null) {
                mAdapter.onItemClick(parent, view, position, id);
            }
        });

        mSwipeRefreshLayout = new SwipeRefreshLayout(getContext());
        LayoutParams swipeParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        swipeParams.addRule(ALIGN_PARENT_TOP);
        mSwipeRefreshLayout.setLayoutParams(listParams);

        mSwipeRefreshLayout.addView(mListView);
        addView(mSwipeRefreshLayout);

        mHeader = new RelativeLayout(getContext());
...

nmvictor avatar Jan 28 '19 09:01 nmvictor

@nmvictor 's solution worked for me but for clarity it was necessary to remove the internal ListView from its parent.

  ListView interalListView = headerListView.getListView();
  headerListView.removeView(internalListView);
  swipeRefreshLayout.addView(internalListView);

grossmae avatar Oct 16 '19 21:10 grossmae