更改TextInputLayout提示行为

时间:2018-06-11 07:02:24

标签: java android kotlin

我需要以这种方式改变TextInputLayout行为。默认情况下,当用户单击布局内的EditText时,提示会离开文本框并向上移动。我需要实现的是:当用户点击EditText时,提示不会做出反应。当用户开始输入时它会移动,然后返回,然后EditText为空。

我使用了一个名为FloatingEditText的自定义库,但它无法正确使用RTL布局。有没有人知道如何使用TextInputLayout实现这一目标,或者从右到左使用其他方式?

提前致谢!

2 个答案:

答案 0 :(得分:0)

您可以在Label部分输入要输入的名称,在印第安部分输入提示。

<android.support.design.widget.TextInputLayout
        android:id="@+id/text_input"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Label">

        <EditText
            android:id="@+id/edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text" />

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

答案 1 :(得分:0)

使用材料成分库,您可以使用sc create "pythonWebServer" binPath= "fullPathToManage.py File" 属性:

placeholderText

enter image description here

注意::这至少需要版本 <com.google.android.material.textfield.TextInputLayout android:hint="Label" app:placeholderText="placeholder"

相关问题