List of usage examples for android.text SpannableString setSpan
public void setSpan(Object what, int start, int end, int flags)
From source file:Main.java
public static SpannableString centerText(SpannableString sequence) { sequence.setSpan(new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER), 0, sequence.length(), 0); return sequence; }
From source file:Main.java
public static SpannableString bold(SpannableString sequence) { sequence.setSpan(new StyleSpan(Typeface.BOLD), 0, sequence.length(), 0); return sequence; }
From source file:Main.java
public static SpannableString stylePartTextBold(CharSequence text, int start, int end) { SpannableString span = new SpannableString(text); span.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); return span;/* w w w . j a v a 2s. com*/ }
From source file:Main.java
public static SpannableString getDeleteStr(String content) { SpannableString sps = new SpannableString(content); sps.setSpan(new StrikethroughSpan(), 0, content.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return sps;//ww w . j a va 2 s . c o m }
From source file:Main.java
/** * /* w w w .j av a2s . c o m*/ * * @param text * @return */ public static SpannableString strickout(String text) { SpannableString ss = new SpannableString(text); ss.setSpan(new StrikethroughSpan(), 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return ss; }
From source file:Main.java
/** * @param text/*from ww w . j a va 2s . c o m*/ * @param color * @param start * @param end * @return */ public static SpannableString highLight(CharSequence text, int color, int start, int end) { SpannableString span = new SpannableString(text); span.setSpan(new ForegroundColorSpan(color), start, end, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); return span; }
From source file:Main.java
public static CharSequence setTextStyleNormal(CharSequence text) { final StyleSpan style = new StyleSpan(Typeface.NORMAL); final SpannableString str = new SpannableString(text); str.setSpan(style, 0, text.length(), 0); return str;//ww w . j av a2 s. c om }
From source file:Main.java
public static CharSequence color(int color, CharSequence sequence) { SpannableString spannable = new SpannableString(sequence); spannable.setSpan(new ForegroundColorSpan(color), 0, sequence.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return spannable; }
From source file:Main.java
public static CharSequence setTextStyleBold(CharSequence text) { final StyleSpan style = new StyleSpan(Typeface.BOLD); final SpannableString str = new SpannableString(text); str.setSpan(style, 0, text.length(), 0); return str;//from w w w. j a v a2 s. c om }
From source file:Main.java
public static CharSequence small(CharSequence sequence) { SpannableString spannable = new SpannableString(sequence); spannable.setSpan(new RelativeSizeSpan(0.9f), 0, sequence.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return spannable; }