Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

setPivotX doesn't work on android 4.1.1 #77

Open
npersson opened this issue Oct 30, 2014 · 1 comment
Open

setPivotX doesn't work on android 4.1.1 #77

npersson opened this issue Oct 30, 2014 · 1 comment

Comments

@npersson
Copy link

I am animating an ImageView by scaleX. This is supposed to be a progress bar which fills from left to right. It works without problem om API 10 and API 18,19. But on API 16 there seems to be a problem with the setPivotX. I have tried every option in http://stackoverflow.com/questions/9496074/nineoldandroids-set-view-pivot .

final ImageView progressBarFill = (ImageView) getView().findViewById(R.id.progressbarImageFill);
...

ViewHelper.setPivotX(progressBarFill, 0);
AnimatorProxy.wrap(progressBarFill).setPivotX(0);
animate(progressBarFill).setDuration(1000).scaleX(0.25f);

and

AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(progressBarFill, "scaleX", 0f, 0.25f)
);
AnimatorProxy.wrap(progressBarFill).setPivotX(0.0f);
ViewHelper.setPivotX(progressBarFill, 0f);
set.setDuration(1000).start();

The animation works but it animates from the center ot the ImageView. Can anyone confirm this issue?

@ashakirov
Copy link

I fixed this problem via setting pivot points throught XML.
android:transformPivotX="0dp"
android:transformPivotY="0dp"

I dont know why but setting same points programmatically via setPivotX, setPivotY methods doesn't work on my 4.1.1 and 4.2 devices.

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

No branches or pull requests

2 participants