Java tutorial
//package com.java2s; import android.text.SpannableString; import android.text.Spanned; import android.text.style.AbsoluteSizeSpan; public class Main { public static SpannableString formatTextSize(String txt, int size, int start, int end) { SpannableString spanString = new SpannableString(txt); AbsoluteSizeSpan span = new AbsoluteSizeSpan(size, true); spanString.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spanString; } }