Android examples for Graphics:Spannable Color
get Background Color Span
/* /*from w w w .j a va 2s. c om*/ * @(#)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 getBgColorSpan(String text, int color) { SpannableString spanString = new SpannableString(text); spanString.setSpan(new BackgroundColorSpan(color), 0, text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return spanString; } }