AndroidSwipeLayout
AndroidSwipeLayout copied to clipboard
SwipeLayout inside ViewGroup inside SwipeRefreshLayout
SwipeRefreshLayout is the official "pull to refresh" layout. I have a ListView that is inside of a SwipeRefreshLayout, and I am using SwipeLayout as my list item rows.
Is there a good way for me to stop the "pull down" action of the SwipeRefreshLayout when I am horizontally scrolling the SwipeLayout when at the top of the ListView? What happens is that when at the top of the ListView, it is really difficult to horizontally pull the SwipeLayout without accidentally resetting it due to the "pull down" action of the SwipeRefreshLayout activating.
It's really a problem, I'll have a try and try to find a good solution.
In swipe listener, you can disable the SwipeRefreshLayout in onUpdate(), and enable it in onHandRelease(). That will block the SwipeRefreshLayout while the user is swiping, and enable it when releases the swipe.
Thanks @skoric , that worked perfectly.
@daimajia , Perhaps a setup function could be exposed that takes the official pull-to-refresh view ID and does this behind the scenes?
It is work well! Thanks @skoric and thanks @mattblang because you open this issue!
well, I think when user swipe left/right, the dy event should be ignore, vice versa. this should making sense.
@soarcn @mattblang Sorry for my late, I'll do it later.
@soarcn @mattblang Pull requests are welcome. :smiley:
@daimajia , Your Pull to refresh not working ..although your ListView-Swipe is working.
(1) * Not Working
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/SwipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/ListView_Home_Screen_Tab"
/>
</android.support.v4.widget.SwipeRefreshLayout>
(2) * Working
<?xml version="1.0" encoding="utf-8"?>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/ListView_Home_Screen_Tab"
/>
( ** Also I'm using AndroidSwipeLayout )
in fragment still cant swipe when the Listview inside SwipeRefreshLayout,When i remove SwipeRefreshLayout it's worked