AndroidViewAnimations icon indicating copy to clipboard operation
AndroidViewAnimations copied to clipboard

set pivot

Open rasam29 opened this issue 7 years ago • 1 comments

Hello :) thank for the great library 👍 i wanted to know How i can set the pivot of animation to center of my view i already try .pivot(0f,0f) but it doesnt work

rasam29 avatar Jun 02 '18 06:06 rasam29

you might be playing the animation too early

https://stackoverflow.com/a/3594216/4129644

You are calling getWidth() too early. The UI has not been sized and laid out on the screen yet.

I doubt you want to be doing what you are doing, anyway -- widgets being animated do not change their clickable areas, and so the button will still respond to clicks in the original orientation regardless of how it has rotated.

That being said, you can use a dimension resource to define the button size, then reference that dimension resource from your layout file and your source code, to avoid this problem.

https://stackoverflow.com/a/10118459/4129644

We can use

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    //Here you can get the size!
}

KieuQ avatar Jul 18 '18 10:07 KieuQ