Best code examples for Android Spannable class (android.text.Spannable)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Spannable class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android Spannable examples from Open Source projects
This code example shows how to use the following methods: removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
94:	URLSpan[] link = buffer.getSpans(off, off, URLSpan.class); 
-
102:	buffer.removeSpan(mLinkFocusStyle); 
-
105:	buffer.setSpan(mLinkFocusStyle, 
106:	buffer.getSpanStart(link[0]), 
107:	buffer.getSpanEnd(link[0]), 
-
116:	buffer.removeSpan(mLinkFocusStyle); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: removeSpan, setSpan, getSpanStart, length
260:	int length = output.length(); 
-
262:	int start = output.getSpanStart(span); 
263:	output.removeSpan(span); 
-
265:	output.setSpan(span, start, length, SPAN_EXCLUSIVE_EXCLUSIVE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getSpans, charAt, length
37:	StyleSpan[] spans = spannable.getSpans(0, spannable.length(), StyleSpan.class); 
-
39:	RelativeSizeSpan[] sizeSpan = spannable.getSpans(0, spannable.length(), RelativeSizeSpan.class); 
-
41:	assertEquals('\n', spannable.charAt(spannable.length() - 1)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: removeSelection, setSelection, getSpanEnd, getSpanStart, getSpans
212:	MyURLSpan[] link = buffer.getSpans(off, off, MyURLSpan.class); 
-
226:	Selection.setSelection(buffer, 
227:	buffer.getSpanStart(link[0]), 
228:	buffer.getSpanEnd(link[0])); 
-
233:	Selection.removeSelection(buffer); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
47:	ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class); 
-
53:	Selection.setSelection(buffer, buffer.getSpanStart(link[0]), buffer.getSpanEnd(link[0])); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setSpan
161:	Spannable span = new SpannableString(name); 
162:	span.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
254:	ClickableSpan[] link = buffer.getSpans(off, off, 
-
262:	Selection.setSelection(buffer, 
263:	buffer.getSpanStart(link[0]), 
264:	buffer.getSpanEnd(link[0])); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSpans
48:	ClickableSpan[] links = buffer.getSpans(off, off, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: append, insert, setSpan, length, toString
39:	output.append("\n"); 
40:	String[] split = output.toString().split("\n"); 
-
43:	int start = output.length() - split[lastIndex].length() - 1; 
44:	output.setSpan(new BulletSpan(15 * mListParents.size()), start, 
45:	output.length(), 0); 
-
49:	output.append("\n"); 
50:	String[] split = output.toString().split("\n"); 
-
53:	int start = output.length() - split[lastIndex].length() - 1; 
54:	output.insert(start, mListItemCount + ". "); 
55:	output.setSpan( 
-
57:	start, output.length(), 0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSpan, length
29:	Spannable wordToSpan = new SpannableString(header + " (DISCONNECTED)"); 
30:	wordToSpan.setSpan(new ForegroundColorSpan(0xFFFF4444), header.length(), wordToSpan.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: removeSpan, setSpan, getSpanFlags
232:	int state = content.getSpanFlags(what); 
-
237:	content.setSpan(what, 0, 0, LOCKED); 
-
241:	content.removeSpan(what); 
-
243:	content.setSpan(what, 0, 0, PRESSED); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
48:	ClickableSpan[] link = buffer.getSpans(off, off, 
-
55:	Selection.setSelection(buffer, 
56:	buffer.getSpanStart(link[0]), 
57:	buffer.getSpanEnd(link[0])); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
83:	URLSpan[] link = buffer.getSpans(off, off, URLSpan.class); 
-
91:	buffer.removeSpan(mClickedColorStyle); 
-
94:	buffer.setSpan(mClickedColorStyle, buffer.getSpanStart(link[0]), buffer 
95:	.getSpanEnd(link[0]), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); 
-
103:	buffer.removeSpan(mClickedColorStyle); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
83:	URLSpan[] link = buffer.getSpans(off, off, URLSpan.class); 
-
91:	buffer.removeSpan(mClickedColorStyle); 
-
94:	buffer.setSpan(mClickedColorStyle, buffer.getSpanStart(link[0]), buffer 
95:	.getSpanEnd(link[0]), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); 
-
103:	buffer.removeSpan(mClickedColorStyle); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
50:	ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class); 
-
57:	Selection.setSelection(buffer, buffer.getSpanStart(link[0]), buffer.getSpanEnd(link[0])); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSpan, setText
37:	Spannable WordtoSpan = new SpannableString(progress); 
-
39:	WordtoSpan.setSpan(new AbsoluteSizeSpan(50), 0, progress.indexOf("%"), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 
40:	WordtoSpan.setSpan(new AbsoluteSizeSpan(22), progress.indexOf("%"),progress.indexOf("%")+1 ,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 
41:	getTextView(listItem).setText(WordtoSpan); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSpans, length
29:	return(str.getSpans(0, str.length() - 1, StyleSpan.class)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: removeSelection, setSelection, getSpanEnd, getSpanStart, getSpans
93:	ClickableSpan[] link = buffer.getSpans(off, off, 
-
100:	Selection.setSelection(buffer, 
101:	buffer.getSpanStart(link[0]), 
102:	buffer.getSpanEnd(link[0])); 
-
110:	Selection.removeSelection(buffer); 
111:	Touch.onTouchEvent(widget, buffer, event); 
-
115:	return Touch.onTouchEvent(widget, buffer, event); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSpan
179:	Spannable sb = new SpannableString(v.getText().toString()); 
180:	sb.setSpan(new BackgroundColorSpan(Color.parseColor(TEXT_HIGHLIGHT_COLOR)), i, i + l, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSpan, getSpans
16:	spannable.setSpan(emptySpan, 1, 1, 0); 
-
18:	spannable.setSpan(unemptySpan, 1, 2, 0); 
-
25:	spans = spannable.getSpans(0, 1, Object.class); 
-
27:	spans = spannable.getSpans(0, 2, Object.class); 
-
29:	spans = spannable.getSpans(1, 2, Object.class); 
-
31:	spans = spannable.getSpans(2, 2, Object.class); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
57:	ClickableSpan[] link = buffer.getSpans(off, off, 
-
64:	Selection.setSelection(buffer, 
65:	buffer.getSpanStart(link[0]), 
66:	buffer.getSpanEnd(link[0])); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
60:	URLSpan[] link = buffer.getSpans(off, off, URLSpan.class); 
-
68:	buffer.removeSpan(mLinkFocusStyle); 
-
71:	buffer.setSpan(mLinkFocusStyle, buffer.getSpanStart(link[0]), buffer 
72:	.getSpanEnd(link[0]), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); 
-
80:	buffer.removeSpan(mLinkFocusStyle); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: removeSpan, setSpan, getSpanStart, length
260:	int length = output.length(); 
-
262:	int start = output.getSpanStart(span); 
263:	output.removeSpan(span); 
-
265:	output.setSpan(span, start, length, SPAN_EXCLUSIVE_EXCLUSIVE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
50:	Object [] spans = buffer.getSpans(off, off, spanClass); 
-
53:	Selection.setSelection(buffer, 
54:	buffer.getSpanStart(spans[0]), 
55:	buffer.getSpanEnd(spans[0])); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
52:	URLSpan[] link = buffer.getSpans(off, off, URLSpan.class); 
-
58:	Selection.setSelection(buffer, 
59:	buffer.getSpanStart(link[0]), 
60:	buffer.getSpanEnd(link[0])); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: removeSelection, setSelection, getSpanEnd, getSpanStart, getSpans
197:	ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class); 
-
203:	Selection.setSelection(buffer, 
204:	buffer.getSpanStart(link[0]), 
205:	buffer.getSpanEnd(link[0])); 
-
210:	Selection.removeSelection(buffer); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: removeSelection, setSelection, getSpanEnd, getSpanStart, getSpans
32:	TouchableSpan[] link = buffer.getSpans(off, off, TouchableSpan.class); 
-
39:	Selection.setSelection(buffer, 
40:	buffer.getSpanStart(link[0]), 
41:	buffer.getSpanEnd(link[0])); 
-
46:	Selection.removeSelection(buffer); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: replace, setSelection, removeSpan, setSpan, length
103:	text.replace(0, text.length(), allText); 
104:	Selection.setSelection(text, selStart, selEnd); 
-
107:	if (suggestedStart < text.length()) { 
108:	text.setSpan(mSuggested, suggestedStart, text.length(), 
-
111:	text.removeSpan(mSuggested); 
-
113:	text.setSpan(mBufferSpanWatcher, 0, text.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSpan, length
66:	str.setSpan(new StrikethroughSpan(), 0, str.length(), 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSpan
66:	((Spannable)((CommentView) convertView).userTexView.getText()).setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSpan
37:	Spannable span = new SpannableString(input); 
38:	span.setSpan(typeFaceRobotoThin, 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 
39:	span.setSpan(new RelativeSizeSpan(0.4f), 1, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
40:	ClickableSpan[] link = s.getSpans(off, off, 
-
47:	Selection.setSelection(s, 
48:	s.getSpanStart(link[0]), 
49:	s.getSpanEnd(link[0])); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
47:	ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class); 
-
53:	Selection.setSelection(buffer, buffer.getSpanStart(link[0]), buffer.getSpanEnd(link[0])); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, length
122:	if(cursorPos > text.length()){ 
123:	cursorPos = text.length(); 
-
127:	Selection.setSelection(text, cursorPos); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: removeSelection, setSelection, getSpanEnd, getSpanStart, getSpans
216:	MyURLSpan[] link = buffer.getSpans(off, off, MyURLSpan.class); 
-
230:	Selection.setSelection(buffer, 
231:	buffer.getSpanStart(link[0]), 
232:	buffer.getSpanEnd(link[0])); 
-
237:	Selection.removeSelection(buffer); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSelection, getSpanEnd, getSpanStart, getSpans
58:	final ClickableSpan[] link = buffer.getSpans(off, off, 
-
64:	Selection.setSelection(buffer, 
65:	buffer.getSpanStart(link[0]), 
66:	buffer.getSpanEnd(link[0])); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSpan, makeText
52:	Spannable text = new SpannableString("Italic green text in toast"); 
53:	text.setSpan(new StyleSpan(Typeface.ITALIC), 0, 18,  Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 
54:	text.setSpan(new ForegroundColorSpan(Color.GREEN), 0, 18,  Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 
55:	Toast.makeText(this, text, Toast.LENGTH_LONG).show(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSpan
82:	Spannable span = new SpannableString(text); 
-
85:	span.setSpan(sizeSpanLarge, 0, firstPos, 
-
87:	span.setSpan(sizeSpanSmall, firstPos + 1, text.length(), 
Full Snippet Info
5
CodeRank
Related Android Spannable Questions & Answers:
See Code Examples for Android Spannable Methods: