Example usage for android.text.style AbsoluteSizeSpan AbsoluteSizeSpan

List of usage examples for android.text.style AbsoluteSizeSpan AbsoluteSizeSpan

Introduction

In this page you can find the example usage for android.text.style AbsoluteSizeSpan AbsoluteSizeSpan.

Prototype

public AbsoluteSizeSpan(@NonNull Parcel src) 

Source Link

Document

Creates an AbsoluteSizeSpan from a parcel.

Usage

From source file:com.forrestguice.suntimeswidget.SuntimesUtils.java

public static SpannableString createBoldColorSpan(String text, String toBold, int color, int pointSizePixels) {
    SpannableString span = new SpannableString(text);
    int start = text.indexOf(toBold);
    int end = start + toBold.length();
    span.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), start, end,
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    span.setSpan(new ForegroundColorSpan(color), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    span.setSpan(new AbsoluteSizeSpan(pointSizePixels), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return span;//w  w w .jav  a2s  .  c o m
}

From source file:com.ruesga.timelinechart.TimelineChartView.java

private DynamicSpannableString createSpannableTick(int tickFormat, CharSequence text) {
    DynamicSpannableString spannable = new DynamicSpannableString(text);
    mTickTextSpannables[tickFormat].put(text.length(), spannable);
    if (tickFormat == (mTickFormats.length - 1)) {
        spannable.setSpan(new AbsoluteSizeSpan((int) (mSize20 * mTextSizeFactor)), 0, 2,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    } else if (tickFormat == 1) {
        spannable.setSpan(new AbsoluteSizeSpan((int) (mSize12 * mTextSizeFactor)), 0, text.length(),
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }// w  w  w  .  j av a 2 s.  co m
    return spannable;
}