这可能看起来违反直觉,但有没有办法禁用或删除浮动标签提示TextInputLayout
?我想使用的原因TextInputLayout
而不仅仅是一个EditText
用于计数器TextInputLayout
提供。
这是我到目前为止所拥有的:
<android.support.design.widget.TextInputLayout
android:id="@+id/textContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
app:counterEnabled="true"
app:counterMaxLength="100">
<EditText
android:id="@+id/myEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|left"
android:inputType="textMultiLine|textCapSentences"
android:maxLength="100"
android:scrollbars="vertical"
android:hint="This is my cool hint"/>
</android.support.design.widget.TextInputLayout>
从版本 23.2.0 开始,您可以调用支持库
setHintEnabled(false)
或将其放入 TextInputLayout xml 中,如下所示:
app:hintEnabled="false"
尽管这个名称可能会让您认为它删除了所有提示,但它只是删除了浮动提示。
相关文档和问题:http://developer.android.com/reference/android/support/design/widget/TextInputLayout.html#setHintEnabled(boolean) http://developer.android.com/reference/android/support/design/widget/TextInputLayout.html#setHintEnabled(boolean)
https://code.google.com/p/android/issues/detail?id=181590 https://code.google.com/p/android/issues/detail?id=181590
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)