android 单词不适合单元格

标签 android layout android-constraintlayout

我正在设计一个数独游戏,它使用单词列表而不是数字。对于布局,我使用了 constraintLayout。 我遇到了一个问题,但是当一个词太大而无法放入一个单元格时。知道我该如何解决吗? p.s 抱歉第一次在这里发帖。所以不确定我的做法是否正确。

screenshot of the app

最佳答案

您可以使用 this library为了使您的文本自动调整大小并适合 View 。
通过使用此库,您不必担心何时更改文本大小以及它是否适合 View 。

下面是使用方法:

1)在grade中添加依赖:

实现 'me.grantland:autofittextview:0.2.1'

2) 将您的 textView 添加到您的布局中:

 <me.grantland.widget.AutofitTextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:textSize="12sp"
    app:minTextSize="8sp" />

关于android 单词不适合单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54966184/

相关文章:

android - 在 Android Kotlin 的 Constraint Layout 中设置适当的约束

android - 按钮的高度自动改变android

c# - 如何在 WPF 中右对齐 RadioButton

Android Studio 布局编辑器 ConstraintLayout : pack vs chain

Android 6 getAccountName() 缺少 android.permission.GET_ACCOUNTS

java - 是否可以使用其列表项 id 而不是 android 中的列表项位置来选择自定义 ListView 项?

android - RTL-Layout 中忽略准则(Android Constraint-Layout)

android - 将 AAR 文件作为依赖项添加到 Intellij 项目

java - 如何正确对齐此布局?