如何在多行中获取Textinputlayout提示android? [英] How to get Textinputlayout hint android in multiple lines?
问题描述
我尝试了许多在线可用的选项,但是似乎都没有用.
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屋!