Hi,

I have a problem getting the absolute position on screen af a View
before and after an update to its layout.
I need this to add an Animation between the two positions of the View.

Currently I'm trying to do something like this:

------------------------------------------------------------
  int[] startPosition = new int[2];
  view.getLocationOnScreen(startPosition);

  // some layout modification that moves the view (onLayout overriden)

  requestLayout();
  invalidate();

  int[] endPosition = new int[2];
  view.getLocationOnScreen(endPosition);

  Animation anim = new TranslateAnimation(startPosition[0],
endPosition[0], startPosition[1], endPosition[1]);
  [...]
-------------------------------------------------------------

But the position doesn't seem to get updated by the requestLayout
call. I get strange behavior and when I debug, the startPosition and
endPosition are equals. It seems the layout calculation is done at
some point in the future after the requestLayout call.

Is there a way to force a full layout calculation ? I can manually
call the onLayout method, but I don't know exactly with which
parameters I need to call it...

Thanks in advance,
Regards,
Florian

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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

Reply via email to