# Hands-on with Material Components for Android: Selection Controls

DevFeed: [Hands-on with Material Components for Android: Selection Controls](<https://devfeed.tech/articles/hands-on-with-material-components-for-android-selection-controls-25995.md>)

Original publisher: [Read original article](<https://medium.com/over-engineering/hands-on-with-material-components-for-android-selection-controls-a2cf17ea4473?source=rss-37290b859aca------2>)

Author: Nick Rout

Published: 2019-08-26T14:11:24Z

Content type: tutorial

Language: en

Sources: [Stories by Nick Rout on Medium](<https://devfeed.tech/sources/stories-by-nick-rout-on-medium.md>)

Topics: [material-components](<https://devfeed.tech/topics/material-components.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [apis](<https://devfeed.tech/tags/apis.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [layout](<https://devfeed.tech/tags/layout.md>), [material-components](<https://devfeed.tech/tags/material-components.md>), [material-design](<https://devfeed.tech/tags/material-design.md>), [material-theming](<https://devfeed.tech/tags/material-theming.md>)

## AI overview

A practical tutorial on Material Components for Android selection controls. It explains the use, behavior, grouping, APIs, and theming of radio buttons, checkboxes, and switches, with layout examples and references to Gradle setup and app themes.

## Source excerpt

Part 8 of a series covering practical usage of Material Components for Android This post will be covering the features and APIs of Radio Button, Checkbox and Switch components. To find out how to handle initial setup of Material Components for Android (including the Gradle dependency and creating an app theme), please see my original post: Setting up a Material Components theme for Android Selection Controls are small components for scenarios in which users need to select options or toggle settings. They are typically found on settings screens and dialogs. From a design perspective, there are three main types of selection controls which can be used in different scenarios: Radio Buttons: A circular control with two possible states; selected or unselected. Has single-select behavior when in a group of other radio buttons (i.e. Only one control can be selected at a time). Checkboxes: A square control with two possible states; checked or unchecked. Has multi-select behavior when in a group of other checkboxes (i.e. Multiple controls can be selected at a time). Switches: A control consisting of a thumb and a track. Has two possible states; on or off. Basic usage 🏁 A MaterialRadioButton, MaterialCheckBox or SwitchMaterial can be included in your layout like so: <LinearLayout ...> <com.google.android.material.radiobutton.MaterialRadioButton android:id="@+id/radioButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Radio Button" /> <com.google.android.material.checkbox.MaterialCheckBox android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Checkbox" /> <!-- Note: ID cannot be 'switch' as this is a Java keyword --> <com.google.android.material.switchmaterial.SwitchMaterial android:id="@+id/switchMaterial" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Switch" /> </LinearLayout>Setting and listening for checks 👂 All of the selection cont