Questions tagged [touch-event]

An event that is triggered when a user 'touches' a GUI component

A TouchEvent is an event that is triggered when a user 'touches' a GUI component. This is most commonly associated with applications that are designed to run on smart phones and touch screens. Many programming languages will treat an TouchEvent the same as a MouseEvent, which helps to provide touch functionality to applications that haven't specifically been designed for touch interactions.

1935 questions
20
votes
5 answers

Dismiss DialogFragment(not Dialog) onTouchOutside

I have searched through all the answers about dismissing a Dialog onTouchOutside, however, I am using DialogFragment in my application. How can I achieve dismissing the DialogFragment when user clicks outside the DialogFragment's region. I have…
C.d.
  • 9,932
  • 6
  • 41
  • 51
20
votes
5 answers

Is there a touch method for UILabel?

I'd like to do an action if someone touches a predeclared UILabel, something like: if (label is touched) { my actions; } Is there a method/way to do that?
Matoe
  • 2,742
  • 6
  • 33
  • 52
20
votes
3 answers

Simulate USB/Bluetooth HID device locally in order to inject events?

Is it possible to simulate a USB or Bluetooth device connected to Android? I would like to make an app which is able to simulate an HID device locally. What I mean by this is: the app should make Android believe that an USB/Bluetooth HID device is…
Rolf
  • 1,129
  • 11
  • 27
18
votes
4 answers

jQuery (Swipe vs. Touch) pageX and pageY keep returning 0

I'm playing with touchstart and touchend events on my iPhone. I built a sample page that has div that if you touch it and scroll the page, it should return the y coordinates of the start and end positions. link: http://jsbin.com/ibemom/2 the…
DA.
  • 39,848
  • 49
  • 150
  • 213
18
votes
2 answers

How to vary between child and parent view group touch events

I decided to post this question and answer in response to this comment to this question: How to handle click in the child Views, and touch in the parent ViewGroups? I will paste the comment here: Suppose I want to override the touch events only for…
user3956566
17
votes
2 answers

Handle touch event for items inside Recyclerview - android

i'm building a simple recyclerview with custom layout (Text view and switch) and a custom adapter. My problem is i can't handle the click event for the switch (Which make it toggle its state), i have built a touch listener for the RecyclerView and…
Fareed
  • 560
  • 2
  • 7
  • 23
17
votes
3 answers

What's the proper way of binding touchstart on React JS?

I am learning React JS and as of now I cannot find any example on the source code, tests or on the official docs. On the docs the touchStart event is said to be supported but handleTouchStart does not work. The only place I found and example that…
Irae Carvalho
  • 777
  • 1
  • 6
  • 19
17
votes
1 answer

Listen for first TouchEvent when using SYSTEM_UI_FLAG_HIDE_NAVIGATION

Starting with API 14 you can use this flag SYSTEM_UI_FLAG_HIDE_NAVIGATION on a View within your Activity to tell the system you want to hide the navigation bar until there is user interaction (screen touch). Once the user taps the screen the bar is…
FoamyGuy
  • 46,603
  • 18
  • 125
  • 156
16
votes
2 answers

How to extend a view's touch area

I have a vertical LinearLayout. It shall act as a quick jump bar. So the width is very small and the height matches nearly the whole screen height. When I touch it and move around inside, everything is fine. That means, my onTouchEvent() is called…
Bernd
  • 675
  • 2
  • 8
  • 30
16
votes
2 answers

A View's onTouchListener vs onTouchEvent

What is the difference between a view's onTouchEvent : public class MyCustomView extends View { // THIS : @Override public boolean onTouchEvent(MotionEvent event) { return super.onTouchEvent(event); } } and its…
topher
  • 1,357
  • 4
  • 17
  • 36
16
votes
1 answer

Get the element under a touchend

As the touchend event is bind to the element where the touchstart is fired, how can I get the element at the position where the finger leaves, when this is outside of the element where the event was binded to.
Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297
15
votes
5 answers

Android drawing a line to follow your finger

What I want to do is to draw a line that will follow my finger. I've created a custom view, and I have an onTouchEvent() that works. I can draw a static line in the onDraw() method without much trouble. I'm not really sure how to get the line to…
jacklin
  • 2,739
  • 1
  • 24
  • 31
15
votes
7 answers

How to prevent ScrollView from intercepting click/touch events of the view behind it?

I have a ScrollView and an ImageView inside a FrameLayout. The ImageView is behind the scroll view My ScrollView have a transparent space (LinearLayout s_layout_transparent with 925px height). So my ImageView can be seen through this transparent…
NghiaDao
  • 383
  • 1
  • 3
  • 14
15
votes
1 answer

Detect every touch events without overriding dispatchTouchEvent()?

I am developing Android library which needs to track all touch events on app that uses it. For now Users should override theirs Activity’s dispatchTouchEvent() on their’s every activity. as shown below @Override public boolean…
Adhikari Bishwash
  • 2,770
  • 28
  • 32
15
votes
3 answers

Why is my system overlay catching all touches (no interaction with underlying view is possible)

I have a service which starts a system overlay. When the overlay is visible, I want it to be touchable/detect touches, but I want to preserve the interaction with the screen behind it (with behind I mean the underlying activity, next to the overlay…
Toni Kanoni
  • 2,265
  • 4
  • 23
  • 29