How to get Textinputlayout hint android in multiple lines?

I have tried many options available online but none of them seem to be working.

I have used this XML for this purpose.

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:hintTextAppearance="@style/TextLabel">

    <com.projects.fonts.RobotoEditText
        style="@style/EditText"
        android:hint="@string/description"
        android:singleLine="false"
        app:font="@string/roboto_regular" />

</android.support.design.widget.TextInputLayout>

I have also set

<item name="android:singleLine">false</item>

in both TextLabel and EditText. But none of them are working.


You can't.

TextInputLayout uses CollapsingTextLayout which measures the hint as a CharSequence :

mTextPaint.measureText(mTextToDraw, 0, mTextToDraw.length())

CharSequence has no notion of a line, thus you can't add more.


It's not quite a hint if it's so long. If you still want to display it consider adding a separate TextView below/above/over and animating it (if want/need to).

链接地址: http://www.djcxy.com/p/92568.html

上一篇: 在向下的三角形中定位HTML框

下一篇: 如何让Textinputlayout在多行提示android?