2015-11-04 98 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