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 setTextURL(String content, int startIndex, int endIndex, String url) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }/*ww w. j ava2 s . c o m*/ SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new URLSpan(url), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextSuper(String content, int startIndex, int endIndex) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }// w ww . j a va 2 s. co m SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new SuperscriptSpan(), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextUnderline(String content, int startIndex, int endIndex) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }// www .ja v a2 s .co m SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new UnderlineSpan(), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextStrikethrough(String content, int startIndex, int endIndex) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }// w w w. j a v a 2 s . c om SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new StrikethroughSpan(), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextBold(String content, int startIndex, int endIndex) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }//from ww w . ja v a2 s . com SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextItalic(String content, int startIndex, int endIndex) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }// ww w .ja v a 2 s.c o m SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextBoldItalic(String content, int startIndex, int endIndex) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }/*from ww w.ja va2 s. co m*/ SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new StyleSpan(android.graphics.Typeface.BOLD_ITALIC), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextSize(String content, int startIndex, int endIndex, int fontSize) { if (TextUtils.isEmpty(content) || fontSize <= 0 || startIndex >= endIndex || startIndex < 0 || endIndex >= content.length()) { return null; }/* w ww. ja v a2s . co m*/ SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new AbsoluteSizeSpan(fontSize), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextImg(String content, int startIndex, int endIndex, Drawable drawable) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }//from www .j ava 2 s . c o m SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new ImageSpan(drawable), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
From source file:Main.java
public static SpannableString setTextBackground(String content, int startIndex, int endIndex, int backgroundColor) { if (TextUtils.isEmpty(content) || startIndex < 0 || endIndex >= content.length() || startIndex >= endIndex) { return null; }/*from w w w . j av a 2 s . c o m*/ SpannableString spannableString = new SpannableString(content); spannableString.setSpan(new BackgroundColorSpan(backgroundColor), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }