首页 > 解决方案 > 带有 2 行文本的按钮

问题描述

我想要一个带有 2 行文本的按钮,如果文本长于 2 行且大小为 maxWidth,则文本应适合按钮边框。

android:maxLines="2"

不工作

有小费吗?

标签: androidandroid-layoutandroid-buttonmaterial-componentsmaterial-components-android

解决方案


使用类似的东西:

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

在此处输入图像描述


推荐阅读