The String is
Or Login to Place your Order
I want Login
word in diffrent color with underline. Also want click event
on Login
word
I wanted to do it using single TextView
. Can I do it using single TextView
?
The String is
Or Login to Place your Order
I want Login
word in diffrent color with underline. Also want click event
on Login
word
I wanted to do it using single TextView
. Can I do it using single TextView
?
I got the answer
String orLoginString = "Or Login to Place your Order";
SpannableString redSpannable= new SpannableString(orLoginString);
ClickableSpan clickableSpan = new ClickableSpan()
{
@Override
public void onClick(View textView) {
//Your code onclick of underline string
}
@Override
public void updateDrawState(TextPaint ds) {
// TODO Auto-generated method stub
super.updateDrawState(ds);
//You change the color of underline string.
//You can make underline visible or invisible
}
};
redSpannable.setSpan(clickableSpan, 3, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
yourtextview.setText(redSpannable);
loginSelectionFirstTimeLaunching.setMovementMethod(LinkMovementMethod.getInstance());