2015-11-04 99 views

回答

0

編輯: 你可以嘗試動畫

final ObjectAnimator rotate = ObjectAnimator.ofFloat(imageview, 
       "rotationY", 0f, 180f); 
     rotate.setDuration(500); /* Duration for flipping the image */ 
     rotate.setRepeatCount(0); 
     rotate.setInterpolator(new AccelerateDecelerateInterpolator()); 
rotate.start(); 

在撤消改變旋轉值的情況下,以180360

final ObjectAnimator rotate = ObjectAnimator.ofFloat(imagemain, 
       "rotationY", 180f, 360f); 
     rotate.setDuration(500); /* Duration for flipping the image */ 
     rotate.setRepeatCount(0); 
     rotate.setInterpolator(new AccelerateDecelerateInterpolator()); 
     rotate.start(); 

以前的答案: 你應該再次調用這些方法撤消更改... 或者您可以從此方法獲得幫助:

public static final int FLIP_VERTICAL = 1; 
    public static final int FLIP_HORIZONTAL = 2; 

public Bitmap flipImage(Bitmap src, int type) { 
     // create new matrix for transformation 
     Matrix matrix = new Matrix(); 
     // if vertical 
     if (type == FLIP_VERTICAL) { 
      // y = y * -1 
      matrix.preScale(1.0f, -1.0f); 
     } 
     // if horizonal 
     else if (type == FLIP_HORIZONTAL) { 
      // x = x * -1 
      matrix.preScale(-1.0f, 1.0f); 
      // unknown type 
     } else { 
      return null; 
     } 

     // return transformed image 
     return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), 
       matrix, true); 
    } 

您可以通過將類型參數翻轉你的位圖垂直水平並通過再次調用該方法時它們恢復到原來的。

+0

再次稱他們不幹活想不通爲什麼他們不工作。 – Droidekas

+0

你可以試試我的方法嗎? –

+0

試過了,它仍然沒有反轉它 – Droidekas