I am trying to move the view to the upper right corner of the screen using ObjectAnimator.ofFloat (...) But I am not getting the expected results. I get the coordinates of the view in advance using ViewTreeListener etc., and I already know the x value that I need to compensate from the end of the total width. I can not get a measurement to go where I want. Relevant Code:
Getting the starting coordinate; where currently displayed:
int[] userCoords = new int[]{0,0};
userControlLayout.getLocationInWindow(userCoords);
userUpLeft = userCoords[0];
userUpTop = userCoords[1];
Surprisingly, I get the same value as userUpLeft (which is in the coordinates of the screen, and not relative to the parent), when I call userControlLayout.getLeft(), I expect that they will differ from each other in my understanding of the documents. Anyway...
Building ObjectAnimators:
ObjectAnimator translateX = ObjectAnimator.ofFloat(userControlLayout, "translationX",
testXTranslate);
ObjectAnimator translateY = ObjectAnimator.ofFloat(userControlLayout, "translationY",
userUpTop, -(userUpTop));
My understanding is that one arg call is equivalent to specifying the final coordinate that you want to translate / move, and the two arg versions start with ... end with or from ... they messed up with both of me and can't get there.
It is clear that I am lacking very fundamental knowledge, just trying to understand what it is. Any guidance is much appreciated. Thank you
source
share