Question

I apologize for that horrible title but I want to be accurate.

I have ScrollView in that LinearView and in that I dynamically create multiple rows filled with sentences by TextView. I set different collors created using SpannableText but I don't know ho to make every single word of that TextView responding the way I want - pop dialog question that will contain this word and ask me what I want to do with it. I want to move it to EditText in next fragment.. only that..

Please, what kind of magic would be the most suitable for this event? And maybe a kick with little example on one sentence.

Was it helpful?

Solution

There are much more you can do with Spannable, this blog post has everything about Spannable, and it should be able to help you.

If you don't want to read the whole blog, than here is the short answer.

Use ForegroundColorSpan.

SpannableString ss = new SpannableString("Color text");
ForegroundColorSpan span = new ForegroundColorSpan(Color.RED);
ss.setSpan(span, 0, ss.length(), 0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top