Issue
My string could look like this: Numbers: [3] or Numbers: [213]
How I can find [] and number inside it and change color of [] and number?
Solution
This problem can be divided into 2 sections
- the colour change. You have to create a string class in this format
var text :String = "<font color=#000>[</font><font color=#6ab04c>213</font><font color=#000>]</font>";
textview.setText(Html.fromHtml(text));
- Finding the values.
In the textwatcher search for the occurrence of the '[' and then format the string accordingly. so a non optimal solution would be str1= "[" str2="219" str3="]"
Now construct the string as mentioned in the section and then set to the textview
Answered By - Narendra_Nath
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.