Fast swipe handled by viewpager, not swipereveallayout
See original GitHub issueThanks for your good library!
I am doing doing a viewpager and one of the pages are populated with a list of SwipeRevealLayout items. My problem is that a fast swipe on the SwipeRevealLayout item triggers the viewpager instead. Is there a way to ensure that it is the SwipeRevealLayout item, that is triggered, also for fast swipe?
layout_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
context.xml (RevealLayoutItem)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_gravity="left"
android:gravity="left"
android:layout_margin="10dp"
android:background="@android:color/black"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<com.chauthai.swipereveallayout.SwipeRevealLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="82dp"
app:dragEdge="right"
app:mode="same_level">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:background="#00FF00"
android:orientation="vertical"
android:showDividers="middle"
android:layout_margin="40dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Details" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginRight="100dp"
android:background="#ffffff"
android:orientation="vertical"
android:showDividers="middle">
<TextView
android:id="@+id/row1_col1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
android:text="Obligationslån, 5%" />
</LinearLayout>
</com.chauthai.swipereveallayout.SwipeRevealLayout>
</LinearLayout>
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
How do disable paging by swiping with finger in ViewPager ...
Does not work sometimes. I'm using a ViewPager with a FragmentPagerAdapter and several Fragment . After setting OnTouchListener to pager, if I fling...
Read more >Create swipe views with tabs using ViewPager
Swipe views allow you to navigate between sibling screens, such as tabs, with a horizontal finger gesture, or swipe.
Read more >RecyclerView has scrolling issues within a ViewPager
They layout is the parent Fragment that has a ViewPager of Fragments. Here is the layout (Fragment): ... Many times I've tried to...
Read more >Controlling swipe direction with ViewPager2 - Droidcon
In one of the places where we are using ViewPager in our app, ... Now that we know that RecyclerView handles view rendering, ......
Read more >Android ViewPager Example Tutorial - DigitalOcean
Android ViewPager. Android ViewPager widget is found in the support library and it allows the user to swipe left or right to see...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In SwipeRevealLayout class, you can set this requestDisallowInterceptTouchEvent to true Mine problem was resolved getParent().requestDisallowInterceptTouchEvent(true);
The explanation from @MhtSuthar gave me a good direction to solve this. For me, I had to use
requestDisallowInterceptTouchEvent
insidesetOnTouchListener
of swipeRevealLayout. For example:(Kotlin)
(JAVA)
That solved my problem of changing page when swiping right.