2017-06-21 30 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);