title: Custom view measuring
body: <p>I have made a custom view - it extends <code>View</code>.  In the <code>onDraw()</code> method I create a circle with a set radius.  At the moment in my xml, I have the <code>layout_width</code> and <code>layout_height</code> set to <code>wrap_content</code>.  The circle is the right size, but when I set an <code>onClickListener</code> I don't have to touch the circle for it to register. I can tap anywhere where there is no other view.</p>
  
  <p>I think I need to do something with <code>onMeasure</code> or <code>LayoutParams</code> but I don't know what exactly. </p>
  
  <p>The aim is for the <code>onClickListener</code> to only be called when I click the circle with the <code>layout_width</code> and <code>height</code> still being set to <code>wrap_content</code>.</p>
  
  <p>EDIT: </p>
  
  <p>This creates a square not a circle as I wanted.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>protected void onDraw(Canvas canvas) {
  
          canvas.drawCircle(canvas.getWidth() /2 , canvas.getHeight() /2,
                  RADIUS, paint);
      }
  
      @Override
      protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          // TODO Auto-generated method stub
          super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  
          widthMeasureSpec = RADIUS;
          heightMeasureSpec = RADIUS;
  
          setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
  
      }
  </code></pre>