I need to make a multiline text material button. I have followed this question's answers, but it turns out that material buttons work differently.
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/toggle_parent_child"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:theme="@style/Theme.MaterialComponents"
android:visibility="gone"
app:checkedButton="@id/button_parent"
app:singleSelection="true">
<com.google.android.material.button.MaterialButton
android:id="@+id/button_parent"
style="@style/Login.Button.ToggleButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Parent\n Device" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_child"
style="@style/Login.Button.ToggleButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Child \n Device" />
I'm getting this:
but I need every word to be in a different line like this: