【发布时间】:2019-12-11 09:19:36
【问题描述】:
我使用 TextInputEditText 和 kotlin。我尝试以编程方式更改提示。但它只是在盒子里改变了。当我写东西时上移时添加 - 上面的提示没有显示。
我在 onCreate 中使用了这段代码:
editTextChooseDate.hint = "Please choose the Date"
然后我检查 editTextChooseDate 是否有一些测试并尝试通过以下方式更改提示:
editTextChooseDate.hint = "Selected Date"
xml中有editTextChooseDate:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutEditTextChooseDate"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextChooseDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:maxLines="1"/>
</com.google.android.material.textfield.TextInputLayout>
我希望以编程方式更改上部提示。
【问题讨论】:
标签: android kotlin android-edittext hint