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
6
votes
1 answer

Override UIGestureRecognizer touchesBegan

I have 1 Main View and 1 SubView: Main View > SubView I think that the Main View is "stealing" the events from the SubView. For example, when I tap on the SubView, only the Main View GestureRecognizer is fire. Here is my custom GestureRecognizer…
Santa Claus
  • 984
  • 1
  • 12
  • 26
6
votes
6 answers

Dispatch Touch event from DialogFragment view to parent activity view

Here is how my layout looks like: I have a parent activity which has a custom view (view1 that handle onTouch events by itself) and 2 buttons (view2 and view3). The DialogFragment has a visible layout shown and the rest is transparent. My dialog…
6
votes
3 answers

Delegate touch event from one view to another

I am trying to implement my own drag and drop with touch view events. I want to trigger dragging with long click, in onLongClick i create view shadow as bitmap and this bitmap is set to imageview. This imageview i want to drag. My problem is, that…
Billda
  • 5,707
  • 2
  • 25
  • 44
6
votes
3 answers

DrawerLayout with HorizontalScrollView into content menu

my question is simple. Can I use an HorizontalScrollView inside the content menu of a DrawerLayout? My DrawerLayout looks like this:
David Martinelli
  • 233
  • 6
  • 16
6
votes
1 answer

How to setOnTouchListener() on a ListPreference?

Handling onTouchEvent on a view is straightforward as every view has the setOnTouchListener() method to do just that. Alas, although ListPreference is a view, it isn't defined in a layout XML, and thus can't be accessed via findViewById(). So... I…
6
votes
0 answers

Workaround to Android SurfaceView touch lag

I've finished programming a functional Android game, but I don't know where to look to fix touch lag: Anytime the screen is touched, the framerate drops in half. My code is basically a copy and paste of LunarLander with an onTouchEvent. Google…
Ben
  • 61
  • 3
6
votes
3 answers

VelocityTracker giving random seeming results

To get a better understanding of how views work, I'm trying to make a RelativeLayout that I can drag around and fling. The idea is to capture onTouch events, set the layout parameters of the RelativeLayout during ACTION_MOVE, and then use a Scroller…
mindvirus
  • 5,016
  • 4
  • 29
  • 46
6
votes
5 answers

In EditText, popup a dialog when clicking on specific subset of text

Found two solutions - please see selected answer When the user clicks in a certain region of an EditText, I want to popup a dialog. I used onClick to capture the click. This partially works: the first time the user taps the EditText, the soft…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
6
votes
1 answer

how to recognise character drawn on canvas

i am using finger paint to draw line,and So far I have come up with the following code: case MotionEvent.ACTION_MOVE: //return if touch is in this area of canvas if (x<=430 || y<=80 || y>=490) return true; //draw path using x and y…
Hamad
  • 5,096
  • 13
  • 37
  • 65
6
votes
1 answer

View only registering MotionEvent.ACTION_DOWN

I'm having an interesting problem...that I can't seem to find the solution for. I'm using an ObjectAnimator to rotate an ImageView; but the onTouchListener only seems to be registering MotionEvent.ACTION_DOWN. (I deduced this from the Log Cats,…
5
votes
1 answer

Android GestureDetector cannot detect onScroll event with FrameLayout

I have a view that extends FrameLayout and need to be notified of the scrolling events on it. this view has an instance of a class that implements the GestureDetector which is invoked by the overriden onInterceptTouchEvent method. private class…
5
votes
4 answers

Android MotionEvent ACTION_MOVE efficiency. How to improve performance?

I am currently working on an app that allows for free-drawing. The current method I am using is as follows: currentLine is a list that keeps a history of all points that ACTION_MOVE returns. public boolean onTouchEvent (MotionEvent event) { …
MrZander
  • 3,031
  • 1
  • 26
  • 50
5
votes
1 answer

Checkin if pressed inside rectF in onTouchEvent

I've been working on a very simple little application using an extended view. The problem is that i can't find what been pressed in my onTouchEvent. I've understood that i've to compare the pressure-points (x and y) to the elements and see which…
dubbe
  • 7,068
  • 1
  • 16
  • 18
5
votes
2 answers

Is it possible to pass an onTouchEvent to multiple views in Android?

I have read a few questions regarding this topic on SO but haven't really found a solid answer to it. I have a framelayout that I stack multiple custom views on, however the onTouch event only works with the top view. (the custom views are all the…
StartingGroovy
  • 2,802
  • 9
  • 47
  • 66
5
votes
0 answers

Android : How can I Swipe Up and Swipe Down in touchListener event of Imageview?

I have application in which I need onTouch swipe Up and Down event. I have implemented onTouch event in application but I have not any idea related to Swipe Up and Swipe Down Does anybody have a code that how can I do this? final ImageView imageView…
Nik88
  • 1,037
  • 10
  • 21