【问题标题】:How to make text visible in Plain Text after changing its size?更改大小后如何使文本在纯文本中可见?
【发布时间】:2020-07-04 22:49:37
【问题描述】:

我在 Android Studio 中更改纯文本大小时遇到​​问题。 这是窗口的默认大小,看起来很完美。

<EditText
        android:id="@+id/editText3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="96dp"
        android:layout_marginLeft="96dp"
        android:layout_marginTop="588dp"
        android:ems="10"
        android:hint="E-mail"
        android:inputType="textPersonName"
        android:textColorHint="#F8F8F8"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

但是在更改这些值后android:layout_width="196dp" & android:layout_height="32dp" 提示顶部被减半。喜欢这个screenshot.。请帮忙。谢谢。

【问题讨论】:

    标签: java android plaintext hint


    【解决方案1】:

    当您设置android:layout_height="32dp" 时,它对于标准文本大小来说太小了。 因此,转换为android:layout_height="wrapcontent" 是理想的解决方案。

    如果您确实必须坚持 32dp 的高度,则应减小文本大小,使其适合给定的 32dp 高度。

    喜欢android:textSize="10dp"

    【讨论】:

      【解决方案2】:

      我不知道为什么,但是在添加背景android:background="#000000" 之后,它看起来很完美。所以解决了

      【讨论】: