如何在多行中获取Textinputlayout提示android? [英] How to get Textinputlayout hint android in multiple lines?

查看:87
本文介绍了如何在多行中获取Textinputlayout提示android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了许多在线可用的选项,但是似乎都没有用.

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

我已将此XML用于此目的.

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>

我也已经设置

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

在TextLabel和EditText中均

.但是它们都不起作用.

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

推荐答案

您不能.

TextInputLayout使用CollapsingTextLayout将提示作为CharSequence进行测量:

TextInputLayout uses CollapsingTextLayout which measures the hint as a CharSequence:

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

CharSequence没有行的概念,因此您不能添加更多行.

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

如果时间太长,这并不是一个暗示. 如果仍要显示它,请考虑在下方/上方/上方添加单独的TextView并设置动画(如果需要/需要).

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).

这篇关于如何在多行中获取Textinputlayout提示android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆