Thanks for the reply, I now know what the problem is. I move codes from dispatchTouchEvent() in ListActibity into onTouchEvent() in ListView (using setOnTouchEvent()), then all go fine. Thank you again!
On 9月24日, 上午1時04分, hackbod <[EMAIL PROTECTED]> wrote: > If you want to work in the coordinate space of a particular view, you > need to intercept the motion events when they are dispatched to that > view. At the point of dispatchTouchEvent(), the event hasn't yet been > delivered to any views so its coordinate is in the space of the > overall window. > > On Sep 23, 2:27 am, Urakagi <[EMAIL PROTECTED]> wrote: > > > Hi, I have a ListActivity, so I also have a ListView in it. > > I want to use ListView.pointToPosition() in dispatchTouchEvent() of > > ListActivity. But when I call MotionEvent.getY(), it returns the Y > > coordinate of "whole screen", but pointToPosition() needs an "local > > coordinate". > > I tried many getTop() or getPaddingTop or something else, but everyone > > returns nothing other to 0. > > Does anyone know how to fix the global coordinate to local coordinate? > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---