简体   繁体   中英

How to remove ellipsize(three dots) in TextInputLayout hint text?

I need to remove ellipsize (three dots) from my hint text and want to show complete text. I am using TextInputLayout widget.

Adding ellipsize attribute to TextInputEditText does not work.

在此处输入图片说明

Below is the code for 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 not showing the whole line. It draw the hint text and measure width from visible text character length. And it uses CollapsingTextHelper that measure the text. So it is not possible to show multipleLine hint in textInput layer.

But you can show multi line hint without using floating hint. For that: set hint in your TextInputEditText and

set android:hint="\\n" int your TextInputLayout .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM