I have a little specific problem, but hopefully someone will call and help.
I wrote a custom zoom animation (wrapping runnables that changes the target view to a handler between a certain amount of time), but when I change the width and height of the view, it happens as if I were scaling (0, 0), whereas I want to scale its center, so I move the view by changing its fields accordingly. The fact is that when the zoom iteration step is too small (i.e., 0.01f or less), I have to change the field of view by about 1px sometimes in only one direction, which makes it look like an animation Itβs buggy, Iβm not sure for sure, but I have tried the following things:
1) I tried to change the fields by overriding the onLayout () of my parent view, which would be changed when setting layoutParams when scaling (I did this to avoid the second call to setLayoutParams () when moving, which now actually doesn't seem to be quite reasonable , since setLayoutParams () just sets some flag to be used later).
2) I check the new fields for installation so that they are set only when the difference between the new and old fields is in both the X and Y directions.
3) I tried using view.offsetLeftAndRight () view.offsetTopAndBottom () instead of changing the layout options to move the view, but that did not help again.
Any suggestions what the trick will do?
source share