title: Rotate image without shrinking on Android
body: <p>I need to create a compass on an app i am working on. So i tried to create a new view called CompassView which basically extends imageview, shows a bitmap that has east west north south pointed on it, uses sensors to find the degrees the phone is pointed at, and rotate the image accordingly so that it would create an actual compass. But the problem is if i try to rotate the image to some angles like 45 degrees, it shrinks down. Here are some images to explain it better.</p>
  
  <p><img src="https://i.stack.imgur.com/e9EKd.png" alt="This is normal"></p>
  
  <p><img src="https://i.stack.imgur.com/PPKiA.png" alt="This is shrinked"></p>
  
  <p>As you can see, the second image is shrinked down when i try to rotate around 45. What i want it to do is this:
  <img src="https://i.stack.imgur.com/trMbB.jpg" alt="this"></p>
  
  <p>Here is the code i am currently using:</p>
  
  <pre><code>        Bitmap bMap = BitmapFactory.decodeResource(getResources(),
                  R.drawable.compass);
          Matrix xMatrix = new Matrix();
          xMatrix.reset();
          xMatrix.postRotate(360-mValue, 75, 75); //This is 75 because 150 is the image width
          Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0,
                  bMap.getWidth(), bMap.getHeight(), xMatrix, true);
          setImageBitmap(bMapRotate);
  </code></pre>
  
  <p>Any help would be appreciated. THanks</p>
  
  <p><strong>EDIT: (SOLUTION)</strong>
  I finally got it working thanks to the accepted answer. Here is the code i am using for anyone who wants to know how it worked:</p>
  
  <pre><code>RotateAnimation rAnimAntiClockWise = new RotateAnimation(
                      360 - mValue, 360 - event.values[0],
                      Animation.RELATIVE_TO_SELF, 0.5f,
                      Animation.RELATIVE_TO_SELF, 0.5f);
  //mValue is the angle in degrees and i subtracted it from 360 to make it anticlockwise, and event.values[0] is the same thing as mValue
  rAnimAntiClockWise.setFillAfter(true);
  rAnimAntiClockWise.setInterpolator(new LinearInterpolator());
  rAnimAntiClockWise.setDuration(0);
  startAnimation(rAnimAntiClockWise);
  </code></pre>