title: How to change checkbox checked color programmatically
body: <p>I'm using the CheckBox view in Android.  I would like to change the color of it when its checked.  Right now its that default dark green color when its checked and I would like to change it to something different and when not checked, just be the default colors.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>CheckBox c = new CheckBox(this);
  c.setId(View.generateViewId());
  
  c.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
      @Override
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
          if(buttonView.isChecked())
          {
              buttonView.setBackgroundColor(Color.rgb(64, 131, 207));
          }
          if(!buttonView.isChecked())
          {
              buttonView.setBackgroundColor(Color.WHITE);
          }
  
      }
  });
  </code></pre>
  
  <p>The problem is that it does not change the right thing.  Any ideas on how to change this color?</p>
  
  <p><a href="https://i.stack.imgur.com/bca81.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bca81.png" alt="enter image description here"></a></p>