我只能旋转一次图像,当我再次单击按钮时,图像冻结并且不旋转。请帮我。
try{
//Bitmap bMap;
//Get ImageView from layout xml file
img = (ImageView) findViewById(R.id.imageView01);
//Decode Image using Bitmap factory.
Bitmap bMap = BitmapFactory.decodeFile(selectedImagePath);
//Create object of new Matrix.
Matrix matrix = new Matrix();
//set image rotation value to 90 degrees in matrix.
matrix.postRotate(90);
//Create bitmap with new values.
Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(), bMap.getHeight(), matrix, true);
//put rotated image in ImageView.
img.setImageBitmap(bMapRotate);
Context context = getApplicationContext();
CharSequence text = "Image Rotated" ;
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}catch (Exception e) {
e.printStackTrace();
displayExceptionMessage(e.getMessage());
}