Suppose there is text in textView1
. It is necessary to find in it links to Internet resources and highlight them.
How to do it?
Example
TextView textView1 = (TextView)findViewById(R.id.text); textView1 .setText("Italic, highlighted, bold.", TextView.BufferType.SPANNABLE); Spannable span = (Spannable)textView1.getText(); span.setSpan(new BackgroundColorSpan(0xFFFFFF00), 8, 19, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); textView1 .setText(span);
Source: https://ru.stackoverflow.com/questions/132769/
All Articles