矛盾しています。しかし、画像の最終結果は若干大きくなっているとリソースアニメーションを使用した場合、それは通常のサイズだに戻りません。XMLへのJavaからアニメーションを移動すると、私はJavaを使用して書いて、XMLリソースに移動したいアニメーションを持って
私は、スケールのためのパーセンテージを使用してみましたが、はるかに大きいサイズの結果は...私はここに私の頭を叩いてること。
Javaのアニメーション
public void animateClickView(final ImageView view) {
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.2f, 0.0f, 1.2f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
AnimationSet animation = new AnimationSet(true);
animation.addAnimation(alphaAnimation);
animation.addAnimation(scaleAnimation);
animation.setDuration(300);
animation.setFillAfter(true);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
ScaleAnimation scaleAnimation = new ScaleAnimation(1.3f, 1.0f, 1.3f, 1.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(250);
view.startAnimation(scaleAnimation);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
view.startAnimation(animation);
}
リソースアニメーション
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true"
android:shareInterpolator="true"
android:duration="300">
<scale
android:fromXScale="0.0"
android:toXScale="1.2"
android:fromYScale="0.0"
android:toYScale="1.2"
android:pivotX="50%"
android:pivotY="50%" />
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0" />
<scale
android:startOffset="301"
android:fromXScale="1.2"
android:toXScale="1.0"
android:fromYScale="1.2"
android:toYScale="1.0"
android:pivotX="50%"
android:pivotY="50%" />
</set>