Android examples for android.text:SpannableString
get Bold Span
import android.graphics.Typeface; import android.text.Spannable; import android.text.SpannableString; import android.text.style.RelativeSizeSpan; import android.text.style.StyleSpan; public class Main { public static Spannable getBoldSpan(String content, int begin, int end, float size) { Spannable spannable = new SpannableString(String.format("%s", content)); StyleSpan sp = new StyleSpan(Typeface.BOLD); RelativeSizeSpan sp1 = new RelativeSizeSpan(size); spannable.setSpan(sp, begin, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); spannable.setSpan(sp1, begin, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); return spannable; }/*from w w w. ja v a 2 s . c o m*/ }