I have searched internet and tried the following code but its not working
SpannableString ss1 = new SpannableString("Health: ");
ss1.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), 0, ss1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
textview1.setText("\n"+ss1+strhealth+"\n\n");
i want output to be like this Health: good
where strhealth = good But it is coming out Health: good What is the mistake ?
I am using android studio 2.1.1
String txt1="Health: ";
SpannableString txtSpannable= new SpannableString(txt1);
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
txtSpannable.setSpan(boldSpan, 0, 8, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.append(txtSpannable);
String txt2="good";
builder.append(txt2);
textview1.lblStatus.setText(builder, TextView.BufferType.SPANNABLE);