// load icon, works for vector// val icon = ContextCompat.getDrawable(context, R.drawable.ic_error_black_24dp)val icon = AppCompatResources.getDrawable(context, R.drawable.ic_error_black_24dp)// change icon color// DrawableCompat.setTint(icon, ContextCompat.getColor(context, R.color.icon_tint))DrawableCompat.setTint(icon, Color.parseColor("#F6CECE"))// this is necessary, else icon won't showicon.setBounds(0, 0, icon.intrinsicWidth, icon.intrinsicHeight)// setErroreditText.setError(getString(R.string.validation_required), icon)
❤️ Is this article helpful?
Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.
Do send some 💖 to @d_luaz or share this article.
✨ By Desmond Lua
A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz
👶 Apps I built
Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.