具有缩放动画的Android自定义视图

时间:2015-09-27 07:25:12

标签: android user-interface

我在自定义视图中绘制一个圆圈,点击时圆圈变大,我应该如何使用动画。

1 个答案:

答案 0 :(得分:0)

使用ScaleAnimation

public void scaleView(View v,float xxScaleValue,float yScaleValue) {
    Animation anim = new ScaleAnimation(
            1f, xScaleValue, //  for the X axis scaling
            1f, yScaleValue) // for the Y axis scaling
    anim.setFillAfter(true); // Needed to keep the result of the animation
    v.startAnimation(anim);
}

在你的活动电话中

scaleView(yourview,2f,2f); //your own scaling values