get Typeface span - Android Graphics

Android examples for Graphics:Spannable Font

Description

get Typeface span

Demo Code

/* /* w w  w.  ja v a  2 s  . co  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 getStyleSpan(String text, int style) {
        SpannableString spanString = new SpannableString(text);
        spanString.setSpan(new StyleSpan(style), 0, text.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        return spanString;
    }
}

Related Tutorials