Android动画
如何同时从左右两侧改变按钮大小,就像这张图片一样:
我尝试了以下代码,但它并没有达到我想要的效果。
public void scaleView(View v, float startScale, float endScale) {
Animation anim = new ScaleAnimation(
startScale, endScale, // Start and end values for the X axis scaling
1f, 1f, // Start and end values for the Y axis scaling
Animation.RELATIVE_TO_SELF, 0f, // Pivot point of X scaling
Animation.RELATIVE_TO_SELF, 1f); // Pivot point of Y scaling
anim.setFillAfter(true); // Needed to keep the result of the animation
anim.setDuration(3000);
v.startAnimation(anim);
}