title: Draw circle in center canvas and rotate view
body: <p>I am drawing a circle in the center (+ some more that i'll leave out) on my own extension of a View. Then I add this to my layout, and in the onClickListener I increment the .setRotation(); But then my circle does not rotate around its center, it's slightly off. Why?</p>
  
  <p>I have tried setting padding and margin to 0 but that doesn't change anything. </p>
  
  <p>Minimal example:</p>
  
  <pre><code>public class MyCircleView extends View
  {
  private int width = 0;
  private int height = 0;
  
  public MyCircleView(Context context)
  {
  super(context);
  }
  
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
  super.onSizeChanged(w, h, oldw, oldh);
  width = w;
  height = h;
  }
  
  @Override
  protected void onDraw(Canvas canvas) {
  canvas.drawCircle(width/2, height/2, width/2, new Paint());
  }
  }
  </code></pre>
  
  <p>And then in main activity:</p>
  
  <pre><code>MyCircleView circle = new MyCircleView();
  myLayout.addView(circle);
  
  circle.setOnClickListener(new OnClickListener() {
  public void onClick(View v) {
  v.setRotation(v.getRotation()+10);
  }});
  </code></pre>