get Font Span - Android Graphics

Android examples for Graphics:Spannable Font

Description

get Font Span

Demo Code

/* // w  w  w.  j  a  v a  2s.c  o m
 * @(#)SpannableStringUtils.java    Created on 2013-11-11
 * Copyright (c) 2013 ZDSoft Networks, Inc. All rights reserved.
 * $Id$
 */
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.BackgroundColorSpan;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
import android.text.style.UnderlineSpan;
import android.view.View.OnClickListener;
import com.example.bigapple_demo.utils.textviewhtml.SimpleURLSpan.UrlSpanOnClickListener;

public class Main{
    
    public static SpannableString getFontSpan(String text, int size) {
        SpannableString spanString = new SpannableString(text);
        spanString.setSpan(new AbsoluteSizeSpan(size), 0, text.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        return spanString;
    }
}

Related Tutorials