title: Custom Checkable View which responds to Selector
body: <p>I have a group of <code>FrameLayout</code> which I want to be checkable/selectable,</p>
  
  <p>That is, after a click I would like the <code>FrameLayout</code> to display as <code>checked</code> - when pressed again I would like it to become un<code>checked</code>. What's more, I want this visual que to be described as usual through though the use of a <code>&lt;selector&gt;</code>.</p>
  
  <p>I can't seem to get this working - I'm not sure what I'm missing:</p>
  
  <pre><code>public class CheckableFrameLayout extends FrameLayout implements Checkable {
      private boolean mChecked = false;
      public CheckableFrameLayout(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  
      @Override
      public void setChecked(boolean checked) {
          mChecked = checked;
          refreshDrawableState();
      }
  
      public boolean isChecked() {
          return mChecked;
      }
  
      public void toggle() {
          setChecked(!mChecked);
      }
  }
  </code></pre>
  
  <p>The layout of the <code>CheckableFrameLayout</code>:</p>
  
  <pre><code>&lt;com.test.view.CheckableFrameLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/selector_horizontal"
      android:clickable="true" &gt;
  </code></pre>
  
  <p>The selector backing it (selector_horizontal.xml):</p>
  
  <pre><code>&lt;item android:drawable="@drawable/selector_vertical_selected" android:state_pressed="false" android:state_checked="true"/&gt;  
  &lt;item android:drawable="@drawable/selector_vertical_pressed" android:state_pressed="true" android:state_checked="false"/&gt;
  &lt;item android:drawable="@drawable/selector_vertical_normal" android:state_pressed="false" android:state_checked="false"/&gt;
  </code></pre>
  
  <p>Using the above code the "state_pressed" is working fine, but the View itself is not becoming checked (not is the <code>Checkable</code> code being called as discovered through debug).</p>