Android SpannableString Create makeColoredString(String text, int color)

Here you can find the source of makeColoredString(String text, int color)

Description

make Colored String

Declaration

public static Spannable makeColoredString(String text, int color) 

Method Source Code

//package com.java2s;

import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;

public class Main {
    public static Spannable makeColoredString(String text, int color) {
        Spannable result = new SpannableString(text);
        result.setSpan(new ForegroundColorSpan(color), 0, text.length(),
                Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        return result;
    }/*from w  w w  .  ja v  a  2 s  .c o m*/
}

Related

  1. getSpanableText(String wholeText, String spanableText)