Skip to content

Commit 23ce319

Browse files
mwajeehafollestad
authored andcommitted
Set hint on TextInputLayout (afollestad#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.
1 parent ea2715c commit 23ce319

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

input/src/main/java/com/afollestad/materialdialogs/input/DialogInputExt.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private fun MaterialDialog.styleInput(
159159
val resources = windowContext.resources
160160
val editText = getInputField()
161161

162-
editText.hint = hint ?: if (hintRes != null) resources.getString(hintRes) else null
162+
getInputLayout().hint = hint ?: if (hintRes != null) resources.getString(hintRes) else null
163163
editText.inputType = inputType
164164
editText.maybeSetTextColor(
165165
windowContext,

0 commit comments

Comments
 (0)