List of usage examples for android.text Spanned SPAN_EXCLUSIVE_EXCLUSIVE
int SPAN_EXCLUSIVE_EXCLUSIVE
To view the source code for android.text Spanned SPAN_EXCLUSIVE_EXCLUSIVE.
Click Source Link
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;//from w w w . java 2s.co m }
From source file:Main.java
public static SpannableString getSpannableString(String str, int firstIndex, int endIndex, Object style) { SpannableString spannableString = new SpannableString(str); spannableString.setSpan(style, firstIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableStringBuilder applyBoldStyle(String text) { SpannableStringBuilder ss = new SpannableStringBuilder(text); ss.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return ss;// ww w . jav a2 s . co m }
From source file:Main.java
/** * /*w ww .jav a 2 s . 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
public static void makeTextViewHyperlink(TextView tv) { SpannableStringBuilder ssb = new SpannableStringBuilder(); ssb.append(tv.getText());//from w ww .j ava2 s .c om ssb.setSpan(new URLSpan("#"), 0, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); tv.setText(ssb, TextView.BufferType.SPANNABLE); }
From source file:Main.java
public static SpannableString formatTextSize(String txt, int size, int start, int end) { SpannableString spanString = new SpannableString(txt); AbsoluteSizeSpan span = new AbsoluteSizeSpan(size, true); spanString.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spanString; }
From source file:Main.java
/** * Apply bold span to a spannable string. *//*from ww w . ja v a 2 s. co m*/ public static void applyBoldSpan(Spannable spannable, int startIndex, int endIndex) { StyleSpan bold = new StyleSpan(android.graphics.Typeface.BOLD); spannable.setSpan(bold, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); }
From source file:Main.java
/** * Modified from {@link android.text.Html} *//*from w ww .ja v a2 s . c o m*/ private static void end(Editable text, Class<?> kind, Object... replaces) { int len = text.length(); Object obj = getLast(text, kind); int where = text.getSpanStart(obj); text.removeSpan(obj); if (where != len) { for (Object replace : replaces) { text.setSpan(replace, where, len, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } }
From source file:Main.java
public static void SpannableforStrUtil(Context mContext, String spannableString, TextView textView, int style, int index) { SpannableString styledText1 = new SpannableString(spannableString); styledText1.setSpan(new TextAppearanceSpan(mContext, style), index, index + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(styledText1, TextView.BufferType.SPANNABLE); }
From source file:Main.java
public static SpannableString setTextSub(String content, int startIndex, int endIndex) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }//from ww w . j a v a 2 s . com SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new SubscriptSpan(), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }