这似乎违反直觉,但有没有办法禁用或删除 TextInputLayout
中的 float 标签提示?我想使用 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"
虽然名称可能会让您认为它删除了所有提示,但它只是删除了 float 提示。
关于android - 禁用/删除 TextInputLayout XML 中的 float 标签提示文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35423569/