activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rootLayout"
tools:context=".MainActivity"
android:background="#fdfdfc">
<com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/chipGroup"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="32dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="8dp"
app:singleLine="false"
app:singleSelection="true">
<com.google.android.material.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chip1"
android:text="Large Text"
style="@style/Widget.MaterialComponents.Chip.Choice"
app:checkedIconEnabled="true"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
/>
<com.google.android.material.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chip2"
android:text="Medium Text"
style="@style/Widget.MaterialComponents.Chip.Choice"
app:checkedIconEnabled="true"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
/>
<com.google.android.material.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chip3"
android:text="Default"
style="@style/Widget.MaterialComponents.Chip.Choice"
app:checkedIconEnabled="true"
/>
<com.google.android.material.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chip4"
android:text="Text Appearance"
style="@style/Widget.MaterialComponents.Chip.Choice"
app:checkedIconEnabled="true"
android:textAppearance="@style/chipTextAppearance"
android:textColor="#ff0f0f"
/>
</com.google.android.material.chip.ChipGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
res/values/styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="chipTextAppearance" parent="TextAppearance.MaterialComponents.Chip">
<item name="android:textSize">28sp</item>
<item name="android:fontFamily">monospace</item>
<item name="android:textStyle">italic|bold</item>
</style>
</resources>
gradle dependencies
// Material components theme
implementation 'com.google.android.material:material:1.0.0'