Hi, I think there may be a bug in getLocationInWindow API, should the calculation below take the padding of view into consideration.
//extract from View.java while (viewParent instanceof View) { final View view = (View)viewParent; location[0] += view.mLeft - view.mScrollX; // missing mPaddingLeft ?? location[1] += view.mTop - view.mScrollY; // missing mPaddingTop?? viewParent = view.mParent; } My application trying to get its top view x,y coordinate on the screen, by calling getLocationOnScreen (which in turn call getLocationInWindow), but it not returning the values I was expecting. My application starts an activity with no title but has a status bar. Calling getLocationOnScreen from my top view, (the one that gets passed into setContentView), I will expect y set to 25. But instead it return 0, digging into the frameworks code reveal the height of the status bar (i.e. 25) is set to mPaddingTop. So if the calculation above includes mPaddingTop, I will get the right value of 25. Or have I misunderstood the API usage? 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en