未验证 提交 be74a35b 编写于 作者: M Muhammad Wajeeh 提交者: GitHub

Set hint on TextInputLayout (#1962)

Set hint on TextInputLayout instead of EditText so that it animates properly when you start typing.

From documentation:
* The hint should be set on the TextInputLayout, rather than the EditText. If a hint is specified
 * on the child EditText in XML, the TextInputLayout might still work correctly; TextInputLayout
 * will use the EditText's hint as its floating label. However, future calls to modify the hint will
 * not update TextInputLayout's hint.
上级 fe847749
...@@ -159,7 +159,7 @@ private fun MaterialDialog.styleInput( ...@@ -159,7 +159,7 @@ private fun MaterialDialog.styleInput(
val resources = windowContext.resources val resources = windowContext.resources
val editText = getInputField() val editText = getInputField()
editText.hint = hint ?: if (hintRes != null) resources.getString(hintRes) else null getInputLayout().hint = hint ?: if (hintRes != null) resources.getString(hintRes) else null
editText.inputType = inputType editText.inputType = inputType
editText.maybeSetTextColor( editText.maybeSetTextColor(
windowContext, windowContext,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册