title: How to make material toggle button in Android to behave like Switch?
body: <p>I am using the following material design library</p>
  
  <p><code>implementation "com.google.android.material:material:1.2.0-alpha01"</code></p>
  
  <p>And this is how I am implementing my Material Toggle Button</p>
  
  <pre><code>&lt;com.google.android.material.button.MaterialButtonToggleGroup
      id="@+id/toggleBtnGroup"
      app:singleSelection="true"
      android:id="@+id/toggle_button_group"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:checkedButton="@+id/leftAlign"&gt;
  
      &lt;com.google.android.material.button.MaterialButton
          id="@+id/leftAlign"
          style="?attr/materialButtonOutlinedStyle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Left"/&gt;
      &lt;com.google.android.material.button.MaterialButton
          id="@+id/centerAlign"
          style="?attr/materialButtonOutlinedStyle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Center"/&gt;
      &lt;com.google.android.material.button.MaterialButton
          id="@+id/rightAlign"
          style="?attr/materialButtonOutlinedStyle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Right"/&gt;
  
  &lt;/com.google.android.material.button.MaterialButtonToggleGroup&gt;
  </code></pre>
  
  <p>Now, as I select other buttons, only 1 button is selected at a time, how can I make sure that if user selects the selected button again, it does not gets unselected. So in essence, I want atleast one of these buttons to be selected at a particular time. <a href="https://i.stack.imgur.com/jZ5r6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jZ5r6.png" alt="Material Button Toggle"></a></p>
  
  <p>How would one do this? </p>