Closed zjingchuan closed 9 years ago
can confirm: doesn't work with SwipeRefreshLayout, having some intermittent results
Can you explain the exact details? [SwipeRefresh -> ListView -> SwipeLayouts] is the hierarchy I understand. But what is the expected results compared to the actual results?
Here is my layout. It is modification of demo from repo
recyclerview.xml
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
sometimes swipe doesn't work, the result is intermittent. try swipe left for delete and pull down to show refresh icon and do again swipe left to delete
You haven't said expected outputs vs actual outputs still @varis. I'm assuming you're saying it works fine when swiping left/right...You then try to refresh...then it stops working?
quite opposite: it doesn't work well before the refresh and works fine after that
@varis I won't have time to look into it for 3 weeks at least. Theres most likely an issue with touch events getting dispatched. If you want to try and solve the issue and don't understand how Android dispatches touch events through its views watch this video: https://www.youtube.com/watch?v=EZAoJU-nUyI And then just start putting breakpoints in the code. My guess is RefreshLayout for some reason is consuming the touchevents before distributing to its children. I could be wrong though.
I too need help on the same.
I have tried this as well:
listNotifications.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getActionMasked()) {
case MotionEvent.ACTION_UP:
// swipeContainer.requestDisallowInterceptTouchEvent(false);
return false;
}
return true;
}
});
Tried to consume all events in ListView (which has a swipe layout on item), and only pass on the ACTION_UP event, so that refresh only happens on lifting the finger, but this is not working.
@zjingchuan The latest version has fixed this problem, try it.
when use SwipeLayout as item for listview ,and put listview in SwipeRefreshLayout(support V4),swipeLayout can't intercept touch event when open an item.