Search code examples
androidandroid-layoutandroid-buttonmaterial-componentsmaterial-components-android

Button with 2 lines of text


I would like to have a button with 2 lines of text and if text is longer than 2 lines and size of maxWidth, the text should fit into the button borders.

android:maxLines="2"

doesn't work

Any tips?


Solution

  • Use something like:

    <com.google.android.material.button.MaterialButton
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:maxLines="2"
        ../>
    

    enter image description here