Questions tagged [android-touch-event]

For questions about detecting, handling and responding to touch events in a view, in the Android platform.

Use this tag for questions related to detecting, handling and responding to touch events in a view, in the Android platform.

Documentation:

190 questions
275
votes
14 answers

Android: Difference between onInterceptTouchEvent and dispatchTouchEvent?

What is the difference between onInterceptTouchEvent and dispatchTouchEvent in Android? According to the android developer guide, both methods can be used to intercept a touch event (MotionEvent), but what is the difference? How do…
Anne Droid
  • 3,151
  • 4
  • 16
  • 15
35
votes
6 answers

Can we use scale gesture detector for pinch zoom in Android?

Can we use scale gesture detector for pinch zoom in Android?
user562237
  • 775
  • 5
  • 15
  • 24
15
votes
5 answers

ViewPager2 with horizontal scrollView inside

I implemented the new ViewPager for my project. The viewPager2 contains a list of fragment private class ViewPagerAdapter extends FragmentStateAdapter { private ArrayList classifiedIds; ViewPagerAdapter(@NonNull Fragment…
12
votes
13 answers

Prevent single tap from changing SeekBar progress

I am using a SeekBar in my Android app. When a user single taps anywhere on the SeekBar, its progress value is changed. I only want the progress value to change when the user slides the SeekBar thumb (just like a UISlider in iOS). I have tried…
lohithadas
  • 121
  • 1
  • 1
  • 4
12
votes
1 answer

Recyclerview: listen to padding click events

I have an horizontal RecyclerView with leftPadding = 48dp, topPadding = 24dp and clipToPadding = false. It starts with an empty space on the left, but when the user scrolls the list its items are drawn on that (previously empty) space. The top space…
11
votes
2 answers

Wrong scale position after applying zoom effect on Android canvas

First of all this is a follow up question originally asked here, Pan, Zoom and Scale a custom View for Canvas drawing in Android Since there was no answer yet, I finally solved my issue using the android-gesture-detectors After applying the…
10
votes
2 answers

MotionLayout problems with children intercepting touch events

I have a motionLayout for the root container, in my main layout. Inside it, there are other views. One of them is a frameLayout, containing a fragment. The fragment is a page, consisting a NestedScrollView etc... MotionLayout has OnSwipe for only…
9
votes
1 answer

SwipeRefreshLayout is not intercepting the MotionEvent of the NestedScrollingChild

I am using a NestedScrollWebView (heavily influenced by the NestedScrollView), which solves many of the known issues associated with using a WebView in a CoordinatorLayout.
9
votes
2 answers

How to handle touch event on google map (MapFragment)?

I am looking for a proper touch event that will be triggered when user touches the map (Google Maps Android API). Does anyone have an idea as to how to do it ?
SachinS
  • 2,223
  • 1
  • 15
  • 25
8
votes
1 answer

Fragments in ViewPager2 does not respond to clicks if scroll position is 0

I am very glad that Google released ViewPager2 which is built on RecyclerView to solve a lot of issues that the old ViewPager has. I quickly replaced my old ViewPager codes to ViewPager2: Replace ViewPager with ViewPager2 in xml Replace…
8
votes
7 answers

Android - how to detect a touch on screen is a "scroll" touch?

I am creating an android app in Java in which I have a lot of around the screen, all of them with onTouchListeners defined. They are wrapped in a because they occupy more space than available in the screen. My problem is:…
Pedro A
  • 3,989
  • 3
  • 32
  • 56
8
votes
2 answers

who calls Activity.dispatchTouchEvent( event )?

I am trying to add touch events from a file to the current application (build a new touch event according to the data found in the file ), and I am trying to understand the chain of calls when a "real" touch event is triggered. From all the searches…
Foad Rezek
  • 694
  • 2
  • 10
  • 22
7
votes
1 answer

MotionLayout - OnSwipe not working on clickable children

I am running into an issue using MotionLayout where a user cannot swipe up/down if they start their swipe on a clickable item. I want the user to be able to swipe over any part of the screen, and the swiping transition is triggered. Basically, the…
7
votes
2 answers

Scrolling issue in horizontal recyclerview in a scrollview

I have a scroll view in my home page, inside that scroll view there are 2 layouts each layout for a recyclerview, each recyclerview will scroll horizontally. When I try to scroll the recyclerview the scroll of scrollview is getting intruppted and…
7
votes
1 answer

Find out which View consumed touch event, if any

I was troubleshooting a view-related issue: a click listener that is not fired when it's supposed to. After a long session of trial-and-error, I found out that a parent view was disabled, thus discarding all events to its children. Is there a way,…
1
2 3
12 13