title: Programmatically created "Circle Button" not drawing
body: <p>I have a custom <code>CircleButton</code> class:</p>
  
  <pre><code>public class CircleButton extends ImageView {
  
  private  int radius;
  private  int x;
  private  int y;
  
  public CircleButton(Context context) {
      super(context);
      constructorTask();
  }
  
  public CircleButton(Context context, AttributeSet attrs) {
      super(context, attrs);
      constructorTask();
  }
  
  public CircleButton(Context context, AttributeSet attrs, int defStyleAttr) {
      super(context, attrs, defStyleAttr);
      constructorTask();
  }
  
  public CircleButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
      super(context, attrs, defStyleAttr, defStyleRes);
      constructorTask();
  }
  
  
  private void constructorTask() {
      x = 300;
      y = 300;
      radius = 100;
  }
  
  @Override
  public void setPressed(boolean pressed) {
      super.setPressed(pressed);
      Log.i("Button Logger","Button Pressed");
  }
  
  @Override
  protected  void onDraw(Canvas canvas) {
      super.onDraw(canvas);
      canvas.drawCircle(x, y, radius, GameView.green);
      Log.i("Drawing status", "CircleButton Drawing...");
  }
  
  }
  </code></pre>
  
  <p>I have a single activity. This activity contains a relative layout with a single custom view.</p>
  
  <p>Here is the custom view:</p>
  
  <pre><code>public class GameView extends View {
  
  public static Paint green = new Paint();
  
  public GameView(Context context) {
      super(context);
      green.setARGB(255,0,255,0);
  }
  
  public GameView(Context context, AttributeSet attrs) {
      super(context, attrs);
      green.setARGB(255, 0, 255, 0);
  
  }
  
  public GameView(Context context, AttributeSet attrs, int defStyleAttr) {
      super(context, attrs, defStyleAttr);
      green.setARGB(255, 0, 255, 0);
  }
  
  @Override
  protected void onDraw(Canvas canvas) {
      super.onDraw(canvas);
      Log.i("GameView Draw Status","Drawing...");
      Main.testButton.invalidate();
      invalidate();
  }
  
  }
  </code></pre>
  
  <p>And here is the activity code:</p>
  
  <pre><code>public class Main extends AppCompatActivity {
  
  public static CircleButton testButton;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      testButton = new CircleButton(getApplicationContext());
      makeFullScreen();
  
          RelativeLayout screenLayout = (RelativeLayout) findViewById(R.id.screenLayout);
      screenLayout.addView(testButton);
  }
  
  private void makeFullScreen() {...}
  
   }
  </code></pre>
  
  <p>For some reason my <code>testButton</code> is not being drawn. Why is it not being drawn?</p>
  
  <p>EDIT ONE: Here is the XML I have.</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="0dp"
      android:paddingLeft="0dp"
      android:paddingRight="0dp"
      android:paddingTop="0dp"
      tools:context="com.example.vroy.customcirclebuttontest.Main"
      android:id="@+id/screenLayout"&gt;
  
      &lt;com.example.vroy.customcirclebuttontest.GameView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/black"
          android:id="@+id/gameScreen" /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>EDIT TWO: I did some further debugging by adding a normal button to the relative layout and it worked fine.</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          testCircleButton = new CircleButton(getApplicationContext());
          makeFullScreen();
  
          testButton = new Button(getApplicationContext());
          testButton.setX(100);
          testButton.setY(100);
          testButton.setText("HELLO WORLD");
  
          RelativeLayout screenLayout = (RelativeLayout) findViewById(R.id.screenLayout);
          screenLayout.addView(testCircleButton);
          screenLayout.addView(testButton);
  
          Log.i("Button Status","Adding Button To Layout");
      }
  </code></pre>
  
  <p>For some reason by circleButton is not working but a normal button is.</p>