OnTouch is called when a touch event is dispatched to a view it allows listeners to get a chance to respond before the target view. It gives a motion event.
Questions tagged [ontouch]
274 questions
15
votes
4 answers
SwiftUI pick a value from a list with ontap gesture
i'm try to pick some value from a swiftUI list with the ontapGesture.
I have a Searchlist of item, the user need to choose one item and then the app will send the choice to an array that later will be use for other info.
now my problem is how do I…

Damiano Miazzi
- 1,514
- 1
- 16
- 38
15
votes
1 answer
Returning true and false in OnTouch?
Does it matter if i return true or false in onTouch() of an OnTouchListener?
I can't see any difference between returning true or false in this example: Android Swipe on List

SoliQuiD
- 2,093
- 1
- 25
- 29
11
votes
3 answers
Prevent Swiping of ViewPager2 when onTouch of inner view
I have a ViewPager2 with a fragment inside,
in the fragment, I have a custom view with certain touch logic that involves moving the finger.
how do I prevent the ViewPager from swiping while the inner view intercepts the touch event?
override fun…

Vasili Fedotov
- 1,091
- 14
- 31
9
votes
1 answer
Rotate Frame layout which contains dynamic buttons
I have a Framelayout which add four imageview at runtime as well in center it contains main image with which user can perform different action but i face the problem with rotate layout view
currently on touch of rotate button i'm doing this
public…

Ajay Pandya
- 2,417
- 4
- 29
- 65
8
votes
6 answers
onTouch, onLongClick together in Android
I'm adding ImageViews to parent layout dynamically and performing zoom in/out operations with onTouch on the added image.
I want to remove the added view with an onLongPress of…

SANDHYA
- 771
- 7
- 18
- 27
7
votes
2 answers
undefined is not and object (evaluating '_props[registrationName]')
react-native:0.43.3
The problem only occurs in Android system, iOS is fine.
When I touch a TouchableOpacity component, the onTouch function won't be executed.
Anyone found this problem?
I built a Calendar with RN. The problem is that when I click…

wp2123
- 83
- 7
7
votes
2 answers
Allow user to control height and width of a view by onTouch
I am trying to implement a user resizable edittext view. It can be resized when user drags the edges of the view.
Here is my onTouchListener for edittext. I have only implemented resizing for left edge. My idea is as the user's touch event x equals…

Alex
- 881
- 2
- 10
- 24
7
votes
2 answers
Is it possible to use dragging events and click event on the same Textview?
In my application I got a requirement to use both click and drag events on the same textView.
I have written the following code:
... }
switch(event.getAction()) {
case MotionEvent.ACTION_UP:
// …

user1891910
- 919
- 3
- 18
- 45
5
votes
6 answers
How to hide and show password on button click in android?
When button pressed want to visible the password otherwise it should be hidden or say dotted.
I have Applied the following code but its not working.
Any help would be appreciated.
button.setOnTouchListener(new…

Anjali Patel
- 807
- 2
- 11
- 23
4
votes
1 answer
How can I check user interaction on android dialog?
Android activity has overridden method onUserInteraction.But how can I check the user interaction in the dialog?I want to develop some logic based on this.Please help
This code works (onUserInteraction)fine with Activity
public class MyBaseActivity…

Peter Kings
- 41
- 3
4
votes
1 answer
How can we get the id of the view that was touched in onTouchListener in Android when the user is moving the finger on the views?
I am not able to get the second view id where the finger is moved. I tried to print the id where the pointer is using the following in the on touch listener.
case MotionEvent.ACTION_MOVE:
int pointerCount = event.getPointerCount();
…

Mohit Ajwani
- 1,328
- 12
- 24
3
votes
0 answers
How to customize ItemTouchHelper in RecyclerView Android
I have a RecyclerView where I want to enable Swipe to Delete/Star on items. My item is a FrameLayout where a MaterialCardView is on the top and the revealed star and archive layouts are under it.
I already made the swipe behavior work using onTouch…

Skaldebane
- 95
- 2
- 11
3
votes
1 answer
My android app crashes, touch button fails to work properly
I am building an app that records and plays audio. I use a touch button to record. Audio is recorded successfully on prolonged touch, but if i tap the button without holding my finger on it for more than one second, my app crashes.
…

Greg
- 357
- 1
- 11
3
votes
1 answer
Understanding why onClick() is Called Even After onDispatchTouchEvent() Returns True
Lets say, in an Android app, we want to have the ability to temporarily and reliably ignore all user touches at any moment.
From the research I have done on stack-overflow as well as here, here, and here, the agreed-upon solution seems to be…

Nerdy Bunz
- 6,040
- 10
- 41
- 100
3
votes
3 answers
Viewpager PageTranformer blocks UI changes onclick in some devices
I have used Custom ViewPager which extends Viewpager . I have used gesture detector to do the scroll event.
here is my code,
public class VerticalViewPager extends ViewPager {
private GestureDetector gestureDetector;
public boolean…

Jyoti JK
- 2,141
- 1
- 17
- 40