Sunday, October 2, 2011

Re: [android-developers] Re: ListView and MotionEvent

An ACTION_CANCEL is sent in the case where the user puts their finger down on a ListView item (or similar) and then starts to scroll. Since the ListView is using it as a scroll command and your finger may stay inside the view, it sends this to cancel the touch on your view.

The ACTION_OUTSIDE would be where a view couldn't or won't scroll and the user drags their finger outside the view that received the ACTION_DOWN. Computers do the same with mouse events and it gives the user the ability to "cancel" a click by holding down and dragging outside of whatever they clicked on.

Those two actions are why it is usually recommended to perform an action on a mouse/touch/key up instead of down.

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 2, 2011 5:28:24 PM UTC-5, John Goche wrote:

Thank you Steven for your reply,

Would you be able to provide some insight on the difference between ACTION_CANCEL
and ACTION_UP. I am somewhat fuzzy on the concept. Anyways, I'm going to give it a go.

Thanks,

John Goche

On Sun, Oct 2, 2011 at 11:36 PM, Studio LFP <studi...@gmail.com> wrote:
You've got it right.

Just make sure you are catching MotionEvent.ACTION_CANCEL and MotionEvent.ACTION_OUTSIDE.

Return false in onTouch to allow it to pass to the Click and LongClick, but change your colors in the onTouch.

Steven
Studio LFP
http://www.studio-lfp.com

-
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-develop...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment