java - 如何删除 TextInputLayout 提示文本中的省略号(三个点)?

标签 java android textinputlayout

我需要从提示文本中删除省略号(三个点)并希望显示完整的文本。我正在使用 TextInputLayout 小部件。

TextInputEditText 添加 ellipsize 属性不起作用。

enter image description here

下面是 TextInputLayout Widget 的代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    style="@style/TextLabel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <include
        android:id="@+id/layout_header"
        layout="@layout/text_header" />

    <com.google.android.material.textfield.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/hint"
        style="@style/TextLabel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="fields"
        android:padding="@dimen/padding_normal"
        app:boxBackgroundColor="@color/white">


        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/edit_text"
            android:singleLine="false"
            android:ellipsize="none"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

最佳答案

TextInputLayout 未显示整行。 它绘制提示文本并根据可见文本字符长度测量宽度。 它使用 CollapsingTextHelper 来测量文本。 因此不可能在 textInput 层中显示多行提示。

但是您可以显示多行提示而不使用 float 提示。 为此:在 TextInputEditText

中设置提示

android:hint="\n" 设置为 TextInputLayout

关于java - 如何删除 TextInputLayout 提示文本中的省略号(三个点)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57325137/

相关文章:

java - 错误: identifier expected in Java

android - 输入布局中 Edittext 下划线和提示之间的差距

java - 如何将 Kotlin 文件添加到旧的 android java 项目?

java - 通过 Jersey/Grizzly 运行测试时,应该如何以及由谁注入(inject) PersistenceContext?

android - 我可以在依赖它的 APK 中使用 Android AAR 的资源吗?

java - 工具 :replace=android:value to &lt;meta-data> element at AndroidManisfest. xml:25:5-17:34 覆盖

java - 应用程序 :passwordToggleEnabled ="true" not working

android - 多色编辑文本提示

Java 服务器/客户端应用程序仅在按 Enter 键时显示消息

android - 没有com.android.tools.build:gradle:2.2.2的缓存版本可用于离线模式