I am using collapsing Toolbar
layout in my android application. while layout is collapse or expand in both case I need collapsing Toolbar
text displaying my "amount" in green and "balance" in red.
I had try to use HTML like below:
collapsingToolbar.setTitle(Html.fromHtml("<font color='green'>50</font><font color='red'>balance</font>"));
I had used SpannableString
like below:
String part1 = " 50";
String part2 = "Balance";
SpannableString str = new SpannableString(part1 + part2);
str.setSpan(new ForegroundColorSpan(Color.parseColor("#ff0000")), part1.length(), str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
collapsingToolbar.setTitle(str);
Both did not work in my case. Dose someone have some new idea to work in this case.