2017-06-21 32 views
4

的Android动画 如何改变双方(左,右) 按钮大小的同时 由于这种图像的Android动画按钮的大小变化

Image sample

我想这个..但它不喜欢工作,我希望

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); 
} 
+0

你是否试图以某种方式做到这一点? – gprathour

回答

0

你试试这个:

v.animate().setDuration(3000).scaleX(endScale);