I have a TextView widget, as shown below
<TextView
android:text="@string/inputText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
The inputText is defined in Strings.xml as
<String name="inputText">The value of input is positive now</String>
Now, I want the whole text to be displayed in Brown color, and only 'positive' in green color.
Is there any way to do so ? in brief my question is multiple coloring for same textview at the same time
this is a dublicate of this question Change text color of one word in a TextView.
String first = "This word is ";
String next = "<font color='#EE0000'>red</font>";
t.setText(Html.fromHtml(first + next));