Rotate an image


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Bitmap bitmapOrg = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.moon);
  2. Matrix matrix = new Matrix();
  3. matrix.postRotate(-40);
  4.  
  5. Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,
  6. bitmapOrg.getWidth(), bitmapOrg.getHeight(), matrix, true);
  7. BitmapDrawable bmd = new BitmapDrawable(resizedBitmap);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.