Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

set pivot #136

Open
rasam29 opened this issue Jun 2, 2018 · 1 comment
Open

set pivot #136

rasam29 opened this issue Jun 2, 2018 · 1 comment

Comments

@rasam29
Copy link

rasam29 commented Jun 2, 2018

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

@KieuQ
Copy link

KieuQ commented Jul 18, 2018

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!
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants