set Absolute Size Span for SpannableString - Android android.text

Android examples for android.text:SpannableString

Description

set Absolute Size Span for SpannableString

Demo Code

import android.text.SpannableString;
import android.text.style.AbsoluteSizeSpan;

public class Main{
    public static SpannableString setAbsoluteSizeSpan(String string,
            int textSize, int start, int end, int flags) {
        SpannableString spannableString = new SpannableString(string);
        AbsoluteSizeSpan span = new AbsoluteSizeSpan(textSize, true);
        spannableString.setSpan(span, start, end, flags);
        return spannableString;
    }//from  w  w  w. jav a  2  s. com

}

Related Tutorials