title: Ripple effect like a checkbox
body: <p>How to use the same ripple effect as the checkbox on the menu buttons. That is, the color of the waves varies depending on the inclusion.
  At the moment, like this:</p>
  
  <p>menu</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
      &lt;item
          android:id="@+id/elect"
          android:icon="@drawable/ic_elect_off"
          android:checkable="true"
          android:checked="false"
          android:title="@string/menu_elect"
          app:showAsAction="ifRoom" /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>Java</p>
  
  <pre><code>public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          inflater.inflate(R.menu.menu_rule, menu);
          MenuItem item = menu.findItem(R.id.elect);
          item.setChecked(rule.isElect());
          item.setIcon(rule.isElect() ? R.drawable.ic_elect_on : R.drawable.ic_elect_off);
  
      }
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if (item.getItemId() == R.id.elect) {
              item.setChecked(!item.isChecked());
              item.setIcon(item.isChecked() ? R.drawable.ic_elect_on : R.drawable.ic_elect_off);
  
              rule.setElect(item.isChecked());
              Labs.get(getActivity()).updateRule(rule);
          }
          return super.onOptionsItemSelected(item);
      }
  </code></pre>
  
  <p>I tried to do it like this, and it worked, but of the minuses - problems with the width of the button, a lot of code.</p>
  
  <p>menu</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
      &lt;item
          android:id="@+id/elect"
          app:actionViewClass="android.widget.CheckBox"
          android:checkable="true"
          android:title="@string/menu_elect"
          app:showAsAction="ifRoom" /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>Java</p>
  
  <pre><code>public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          inflater.inflate(R.menu.menu_rule, menu);
  
          MenuItem item = menu.findItem(R.id.elect);
          final CheckBox checkBox = (CheckBox) item.getActionView();
          checkBox.setButtonDrawable(R.drawable.elect);
          checkBox.setChecked(rule.isElect());
  
          checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                  rule.setElect(checkBox.isChecked());
                  Labs.get(getActivity()).updateRule(rule);
              }
          });
      }
  </code></pre>
  
  <p>elect drawable</p>
  
  <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item
          android:state_checked="false"
          android:drawable="@drawable/ic_elect_off" /&gt;
      &lt;item
          android:state_checked="true"
          android:drawable="@drawable/ic_elect_on" /&gt;
  &lt;/selector&gt;
  </code></pre>