'k, thanks. On Apr 19, 9:41 am, Dianne Hackborn <hack...@android.com> wrote: > I don't understand exactly what you are looking for, but event dispatching > works as I described -- ViewGroup's impl looks at the event and views to > decide which view it should dispatch to, modifying the MotionEvent at that > point to be appropriate for the target view. > > Be careful how tricky you get here -- for example don't rely on the > implementation detail that the same motion event is used, because that won't > always be the case. For example in Android 3.0 ViewGroup will split > multi-touch events across multiple views and generate new motion events as > part of that, and older versions of the platform will generate motion events > at some points. > > In other words, put your logic in dispatchTouchEvent, and implement it to be > self-consistent. If you want to decide which view the event will go > through, you can look at the position of the event and find the view that is > under it. > > > > > > > > > > On Tue, Apr 19, 2011 at 7:48 AM, Keith Wiley <kbwi...@gmail.com> wrote: > > So, I have two views, a background that covers the screen, and an > > EditText that I reposition over the screen at various times. They > > both implement dispatchTouchEvent (as well as zillions of gesture > > detection methods), but I really only want to operate on one or the > > other in any given instance. Taps on the background should be > > processed by the background view and taps on the EditText (my derived > > subclass) should be processed by that view. I already tried storing > > the event reference itself and in each dispatchTouchEvent() call, > > first asking the other view if it already processed that view, but the > > reference does not change from one action to another -- it's always > > the same event, so I have resorted to saving the event's eventTime, > > and that seems to work, but it feels like hack, meaning, I would > > imagine there is a more direct way to accomplish my goal. > > > Do you think I'm on the right track or would your recommend a > > different approach? > > > On Apr 18, 7:48 pm, Dianne Hackborn <hack...@android.com> wrote: > > > It isn't know at that time; it won't be determined until you call the > > > superclass to ViewGroup.dispatchTouchEvent, which determines the child > > view > > > and adjusts the motion event to dispatch to the child. > > > > On Mon, Apr 18, 2011 at 7:07 PM, Keith Wiley <kbwi...@gmail.com> wrote: > > > > Given the MotionEvent received dispatchTouchEvent(), is there anyway > > > > to determine at that time which view received (or is about to receive) > > > > the event, assuming it is a down event I suppose? > > > > > -- > > > > 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+unsubscr...@googlegroups.com > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > > Dianne Hackborn > > > Android framework engineer > > > hack...@android.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-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them.
-- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en