我需要从提示文本中删除省略号
(三个点)并希望显示完整的文本。我正在使用 TextInputLayout 小部件。
向 TextInputEditText
添加 ellipsize
属性不起作用。
下面是 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/