You can use TextPaint .
TextPaint tp = new TextPaint(); tp.linkColor = Color.BLACK; //you can use your color using Color.parseColor("#123456"); UnderlineSpan us = new UnderlineSpan(); us.updateDrawState(tp); SpannableString sp = new SpannableString("Welcome to android"); sp.setSpan(us, 11, 18, 0); // UnderlineSpan Object, Start position, End position, Flag. et.setText(sp);
This works for me. Hope this helps you.
source share