Questions tagged [motionevent]

MotionEvent object used to report movement (mouse, pen, finger, trackball) events. Motion events may hold either absolute or relative movements and other data, depending on the type of device. Motion events describe movements in terms of an action code and a set of axis values. The action code specifies the state change that occurred such as a pointer going down or up. The axis values describe the position and other movement properties.

468 questions
5
votes
2 answers

MotionEvent handling in ScrollView in Android

I've been trying to figure out the behavior of MotionEvents in ScrollViews in Android and there's something i can't figure out. As an example I made an Activity that has a ScrollView inside of it and the ScrollView has a LinearLayout inside of it. I…
Rotem
  • 1,472
  • 2
  • 11
  • 18
5
votes
1 answer

Motionevent Action_MOVE keeps firing X and Y even if not moved

I am trying out simple program that have sounds based if moved. so at the beginning I have down - which play sound 1 and from then every move it is keeps playing a sound. At count 4 I have made it to play from start. here is the problem: When I…
TheDevMan
  • 5,914
  • 12
  • 74
  • 144
4
votes
1 answer

Simulate smooth Drag Event programmatically

I used custom DragLinearLayout. All child I added using addDragView() are draggable (user interaction). I want to simulate Drag Event for clicked View (smooth move to the bottom of Layout). ACTION_DOWN -> ACTION_MOVE -> ACTION_UP I tried this code,…
Volodymyr Kulyk
  • 6,455
  • 3
  • 36
  • 63
4
votes
2 answers

Android MotionEvent pressure unit of measurement

I am using the getPressure(index) method from the MotionEvent instance to get a value of the pressure applied to screen. I am trying to figure out how to convert that value to at least an approximation of a standard measurement unit. in Android the…
DArkO
  • 15,880
  • 12
  • 60
  • 88
4
votes
0 answers

Intercepting Touch Event Nested Scroll View EditTexts and Spinners

I have a Fragment with a couple of EditTexts, Spinners and SeekBars, and before you know it, it's really hard to find a piece of whitespace to be able to scroll inside the NestedScrollView. It makes the UI feel very broken. I'm not sure if it is a…
4
votes
3 answers

MotionEvent.ACTION_DOWN not being called even though I return true for it

I have an onTouchListener for my LinearLayout of ListViews and I am trying to use the ACTION_DOWN and ACTION_UP data to detect when a user has swiped to the next ListView. However, the MotionEvent never equals ACTION_DOWN, although ACTION_UP works…
ravensgo
  • 502
  • 3
  • 8
  • 26
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
4
votes
1 answer

android drag and drop ImageView onTouchListener

Hello I've set up an onTouchListener within my application for an ImageView, my aim was to have an ImageView that the user would be able to drag around and place where ever they want within the app. I've written some code using sample code found on…
4
votes
4 answers

PointerIndex versus id in android

I m referring to some websites like http://developer.android.com/reference/android/view/MotionEvent.html http://www.vogella.com/tutorials/AndroidTouch/article.html to learn MotionEvent for designing User Interface. The problem is i am getting…
user3212719
  • 129
  • 1
  • 8
4
votes
1 answer

Android finger detection - Orientation and ellipse

I've been looking for a way to detect the finger orientation together with a simplification of the touch area in the form of an ellipse, when using a mobile touch device. I choose Android rather than iOS since I found three usefull methods…
Camilla Horne
  • 91
  • 1
  • 7
4
votes
2 answers

Check if MotionEvent.ACTION_UP is out of the imageview

The user will touch a image and it is important that if he left his finger up in that image or not i tried with writing a onTouchListner() and after that using swich case but i don't know how to continue image.setOnTouchListener(new…
Mostafa Jamareh
  • 1,389
  • 4
  • 22
  • 54
4
votes
1 answer

WindowManager.LayoutParams combination that can pass events to layers under TYPE_SYSTEM_ALERT or smilar

Can someone please help me to get WindowManager.LayoutParams combination that can pass events to layers under TYPE_SYSTEM_ALERT or similar overlay type (that sits top of every other window). Problem: My problem is when the window type…
SAN
  • 959
  • 4
  • 11
  • 17
4
votes
1 answer

Gamepad Support Android

I am trying to add gamepad support to my game but I can't find anywhere how to get the motion events from a gamepad's joysticks. I have something like this but it never seems to get called or do anything. I am testing on a XOOM with JellyBean and my…
Alchitry
  • 1,369
  • 1
  • 16
  • 29
3
votes
1 answer

android jetpack compose: ACTION_UP only reached for tap but not after ACTION_MOVE when using pointerInteropFilter

I need to scroll programatically (in order to snap items to adjust symmetrically top and bottom) after scrolling or after a tap (click) in a lazy column. I also need to start at a specific item when app launches - starts. I am using…
3
votes
2 answers

android: how can I detect when user touch left 20% of view area?

In an activity by using public boolean dispatchTouchEvent(MotionEvent ev) how can I know an user is touching left Y-axis of 20% edge area? It should be generic and orientation handled. I don't want to create any hidden view on that.
DayDayHappy
  • 1,679
  • 1
  • 15
  • 26
1 2
3
31 32