У меня визуальная аномалия в пользовательском MaterialEditText.Я изменил onDraw для отображения валидатора поля (действительный адрес электронной почты или нет).У вас есть трек для решения этой проблемы?
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
conditions.forEach {
val predicate = it.predicate(text.toString())
val pen = when {
showErrorIfNeeded && !predicate && !text.isNullOrEmpty() -> redPen
predicate && !text.isNullOrEmpty() -> greenPen
else -> greyPen
}
val icon = when {
showErrorIfNeeded && !predicate && !text.isNullOrEmpty() -> errorIcon
predicate && !text.isNullOrEmpty() -> okIcon
else -> nokIcon
}
val label = if (showErrorIfNeeded && !predicate) it.errorLabel else it.normalLabel
canvas.withTranslation(x = scrollX.toFloat(), y = scrollY.toFloat()) {
drawText(label,
it.position.left + conditionIconHorizontalSpace,
it.position.top + (height - saveViewHeightExtra) + conditionLineHeight + conditionMargin,
pen)
drawBitmap(icon,
it.position.left,
it.position.bottom + (height - saveViewHeightExtra) - icon.height + conditionMargin,
bitmapPaint)
}
}
}