Code example for SpannableStringBuilder

Methods: insertlengthsetSpan

0
        return spannablestringbuilder;
    } 
 
    public CharSequence getMarketPrice()
    { 
        SpannableStringBuilder spannablestringbuilder = new SpannableStringBuilder(product.getMarketPrice());
        spannablestringbuilder.setSpan(colorSpanGray, 0, spannablestringbuilder.length(), 17);
        spannablestringbuilder.setSpan(new StrikethroughSpan(), 0, spannablestringbuilder.length(), 33);
        spannablestringbuilder.insert(0, context.getResources().getText(0x7f090043));
        return spannablestringbuilder;
    } 
 
    public CharSequence getNameAndAdWord()
    { 
        SpannableStringBuilder spannablestringbuilder = new SpannableStringBuilder((new StringBuilder(String.valueOf(product.getName()))).append(product.getAdWord()).toString());
        int i = product.getName().length();
        int j = spannablestringbuilder.length();
        spannablestringbuilder.setSpan(new RelativeSizeSpan(1.2F), 0, i, 33);
        if(product.getAdWord().length() > 0)
            spannablestringbuilder.setSpan(colorSpanRed, i, j, 33);
Stop searching for code, let great code find you!  Add Codota to your java IDE