AndroidSwipeLayout icon indicating copy to clipboard operation
AndroidSwipeLayout copied to clipboard

SwipeLayout inside ViewGroup inside SwipeRefreshLayout

Open theblang opened this issue 10 years ago • 9 comments

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.

theblang avatar Sep 29 '14 15:09 theblang

It's really a problem, I'll have a try and try to find a good solution.

daimajia avatar Sep 30 '14 00:09 daimajia

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.

skoric avatar Oct 09 '14 09:10 skoric

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?

theblang avatar Oct 10 '14 15:10 theblang

It is work well! Thanks @skoric and thanks @mattblang because you open this issue!

jacsonLee avatar Nov 18 '14 06:11 jacsonLee

well, I think when user swipe left/right, the dy event should be ignore, vice versa. this should making sense.

soarcn avatar Dec 05 '14 02:12 soarcn

@soarcn @mattblang Sorry for my late, I'll do it later.

daimajia avatar Dec 29 '14 10:12 daimajia

@soarcn @mattblang Pull requests are welcome. :smiley:

daimajia avatar Dec 29 '14 10:12 daimajia

@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 )

suman-cribello avatar Apr 05 '16 13:04 suman-cribello

in fragment still cant swipe when the Listview inside SwipeRefreshLayout,When i remove SwipeRefreshLayout it's worked

r020477888 avatar Feb 11 '20 01:02 r020477888