Android : How to use TouchListener to react to movement across button -
I am new to Android development and I was wondering if there is a way to add a TouchListener (or an Event Listener).
Such a button is such that it responds to the movement of the entire area, for example, if I have the middle of the screen I have a button and I start swift from the top, then my reaction will be when my finger button reaches the area.
This is the code that I thought was
Private On-Touch Listener TLIS = New AutoTelevision () {Public Boolean On-Touch (see V, Motion Event Event ) Find button B = (button) VVBIID (R.B. button 1); B.setText ("touched"); return false; }}; Thanks for any help!
Unfortunately not. Touch events are distributed by the parents to the child's thoughts, and only if the initial touch event (i.e. ACTION_DOWN) is found within the range of that view, if no viewer sees ACTION_DOWN, then for that gesture Also, touch events will not be visible later.
It is not possible that this is not possible, but instead of setting up the listener, you need to create a custom ViewGroup button on the screen area, which requires more work. Recruit and monitor all touch events, the button can deliver them when they are within their limits regardless of whether the initial down event has occurred or not. Optional option of a custom parent view is to override sender-touch event () method in its activity and monitor touch events there. Although similar principles, however, you will need to push the button manually to the touch event when you can find out that the finger is within its range. To forward the event you want to pass with the button sender TouchEvent () / Code> method directly MotionEvent before you forward it Prior to getting a different X / Y location, possibly, offer a small amount of massage. As always, try to not override the custom-type code in Android, the return value of the methods that work for you, unless you're sure that you need your app In the touch event, the entire Response Chain controls.
Comments
Post a Comment