我正在为ImageView
using制作动画scaleX()
。这应该是一个从左到右填充的进度条。它在 API 10、18 和 19 上没有问题。但在 API 16 上,该方法似乎存在问题setPivotX()
。我已经尝试过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);
和
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();
动画有效,但它从ImageView
. 谁能确认这个问题?
更新
我也尝试过使用androids标准动画包:
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
progressBarFill.setVisibility(View.VISIBLE);
progressBarFill.setPivotX(0);
progressBarFill.setPivotY(0);
AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(progressBarFill, "scaleX", 0f, 0.25f)
);
set.setDuration(2000).start();
}
但在 android API 16 上仍然不起作用。所以问题不仅与 NineOldAndroids 库有关,还与标准动画函数有关。