【问题标题】:Android's TextView not showing specific digitsAndroid TextView 不显示特定数字
【发布时间】:2020-03-26 14:15:46
【问题描述】:

我无法在 TextView 中显示特定数字。当我尝试以编程方式或仅在 xml 中更新视图的 text 时,就会发生这种情况。

这是布局文件中定义的 TextView,

<TextView
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:textAlignment="center"
        android:text="0"
        android:textColor="@color/primaryTextColor"
        android:textSize="48sp"
        app:layout_constraintBottom_toBottomOf="@+id/title"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@+id/title"
        android:gravity="center_horizontal" />

我也可以在 Android Studio 编辑器中看到这一点。如果我将text 设置为 1、2 和 3,我可以看到显示的数字。但是,如果我将text 设置为 0、4、5、6、7、8 和 9,那么什么都没有。

我在这里缺少什么?

编辑: 我直接从 Android Studio 的布局编辑器添加了两个屏幕截图。 每个屏幕截图代表具有不同值的相同文本视图:

对于text="123"

现在是text="142"

注意:4 似乎占用了TextView 中的一个字符空间,但它没有显示出来。

【问题讨论】:

  • 调试 textview 值,通过记录 textview.getText()。检查日志什么是 textview 当前值。
  • 我做到了!文本应该是@Heisenberg。
  • 检查这可能会有所帮助stackoverflow.com/questions/20144142/…
  • 该死的人@MohammedAlaa,敏锐的观察力!谢谢

标签: android textview numbers


【解决方案1】:

问题是特定字体系列无法显示所有数字。

【讨论】:

    猜你喜欢
    • 2013-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-25
    • 1970-01-01
    相关资源
    最近更新 更多