Open ioterateam opened 6 years ago
Hi @ioterateam, you need to disable swipeRefreshLayout until 1first row is fully visible (so SwipeLayout do not get the events).
TouchHandler mTouchHandler;
+ add setterdispatchTouchEvent(MotionEvent ev)
mTouchHandler.onTouchEvent(ev)
setTouchHandler(this);
onTouchEvent(MotionEvent ev) { mSwipeRefreshLayout.setEnabled(getRowHeaderLayoutManager().findFirstCompletelyVisibleItemPosition() == 0) }
you might want to check if the event is DOWN or MOVE, depending what you achieve.
I tried to use the @sonique6784 answer. It doesn't work that well. It's always stuck at the first touch -> the row move from 4,5 to 0. and next touch the swipe refreshlayout is enable (need at least 2 touches)
So please @evrencoskun add the pull to refresh layout feature for the table
you can try this
//解决滑动冲突 tableView.getCellRecyclerView().addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); refreshLayout.setEnabled(tableView.getCellLayoutManager().findFirstVisibleItemPosition() == 0); } });
@83849 's answer is genius, completely works for me. A better way is to change findFirstVisibleItemPosition() to findFirstCompletelyVisibleItemPosition() to make sure the first item is completely visible, then you set the swipe refresh layout to be enabled.
It's doing refresh instead of scrolling up
If
TableView
inside ofSwipeRefreshLayout
in the xml, it's work fine if i'm scrolling down, but when i'm trying to scroll up the table, it's doingrefresh
instead of scrolling up, can you fix that?Can you fix this? Or it's just my fault?