10

有没有办法自动将按钮的文本大小调整为最大,同时保持一行,并且仍然适合按钮?

4

1 回答 1

0

查看Autosizing TextViews(提供对 API 级别 14 的支持)。

例如

<Button
    android:id="@+id/button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:maxLines="1"
    android:text="Some text"
    app:autoSizeTextType="uniform" />

这里的关键属性是app:autoSizeTextType

于 2022-02-09T10:46:16.093 回答