I am developing an application in which there will be a search screen where user can search for specific keywords and that keyword should be highlighted. I have found Html.f
Using color value from xml resource:
int labelColor = getResources().getColor(R.color.label_color); String сolorString = String.format("%X", labelColor).substring(2); // !!strip alpha value!! Html.fromHtml(String.format("text", сolorString), TextView.BufferType.SPANNABLE);