Questions tagged [ontouch]

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.

274 questions
3
votes
1 answer

How can I separate the screen into two equally big spaces which react to touch events independently?

At first for better imagination, this is what the gui looks like. When you touch below the right rectangle on the right side of the screen, the right rectanglemoves downwards. But when both players do this on there side, there is a ACTION_MOVE…
Jonas1902
  • 93
  • 1
  • 10
3
votes
2 answers

How to swipe a component left to right in android

I try to swipe a component in a layout file .I try to do it different ways . But It dosen't work for me .Here are some thing I used to do this , LayoutInflater inflater = (LayoutInflater)…
Terance Wijesuriya
  • 1,928
  • 9
  • 31
  • 61
3
votes
1 answer

DrawerLayout and ImageView both implementing onTouchListener

I'm moving to a DrawerLayout however the said layout also contains an ImageView on top of which an onTouchListener is implemented for zoom/rotate functionality. The problem is drawers own touch handler crashes my application when I try any of the…
3
votes
0 answers

Moving a textview inside imageview bounds

I want to move a textview inside an imageview such that it should not go outside the imageview. If I touch and move the textview, it should follow my finger. But if i move it ouside the imageview, my textview should not move outside the…
Shahbaz Pothiawala
  • 1,175
  • 5
  • 20
  • 38
3
votes
3 answers

Android - send information to the mainActivity from the onTouch method in a Custom View

I have a custom view (DrawFigures) which has an onTouch method to perform a series of actions. There's a layout that has a few buttons, a TextView and a RelativeView to add the custom view dynamically. Then, in the MainActivity.class, I need to…
daalgi
  • 169
  • 1
  • 14
3
votes
1 answer

Android disable child onTouch when ScrollView scrolls

On my layout, I have a ScrollView which hosts a VideoView and other TextViews. My VideoView has a onTouch listener to start playing the video: viPlayer.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v,…
Alin
  • 14,809
  • 40
  • 129
  • 218
3
votes
0 answers

Action_outside not called for my view

I have created view like toast message. I need to find outside touch of my view(linear layout). I have set this flag to my main activity Window window = getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, …
Strange
  • 59
  • 1
  • 8
3
votes
1 answer

OnTouchListener return value

I'm trying to understand full the OnTouchListener, but I have some doubts. I have this xml code:
user2558672
  • 87
  • 1
  • 7
2
votes
1 answer

Touch not detected on edges when touch is held

I have an app which detects swipe on edge of the screen using an overlay view. Now I wanted to add an action which will be performed when the overlayed view is touched and held without moving. However, I observed some weird behaviours, which I…
Hasmet D
  • 21
  • 1
  • 4
2
votes
0 answers

How to detect a swipe without detecting a tap in kotlin

I have been programming an app in kotlin. This app allows a user to swipe through an imageView and plays a sound when a user taps the screen. The onSwipeTouchListener class below is the onTouchListener for my imageView. I am using the…
2
votes
1 answer

ImageView - get color of touched pixel

I have following image, consisting of three colors (white, grey, black):
Tom11
  • 2,419
  • 8
  • 30
  • 56
2
votes
0 answers

setOnClickListener is not working while setOnTouchListener is working in kotlin

I am making an meme maker application so i am allowing the user to add textviews to the image and drag the textview anywhere in the imageview. Initially all textviews are in 'GONE' visibility and when user clicks on 'Add text' button, i will make…
2
votes
1 answer

DOM changes stop touch event listeners

I have an issue with React touch events handlings that stop working when the DOM changes. I have a parent item with a onTouchMove handler. If I start my touch movement above this element and a child element that disappears during the touch movement…
jolivier
  • 7,380
  • 3
  • 29
  • 47
2
votes
1 answer

How to detect shapedrawable that drawn on a canvas was touched?

I draw a shapedrawables on a canvas and I want to detect on touch event what shapes has been touched. without calculating by (x,y), just automatically as exists in html.. Thanks! :) I succeeded to draw the shapes, and read a lot about how I can…
2
votes
4 answers

Button pressed once and button holds increments value(continuously)

I'm making a button that increments the value when press once and hold press the button. As long as the button is hold, the value will keep increasing. I've been told to use onTouch instead of onClick to do this, but couldn't find the right way to…
Grey
  • 147
  • 1
  • 2
  • 12
1
2
3
18 19