An Android Spannable is an interface for text to which markup objects can be applied.
Questions tagged [spannable]
302 questions
0
votes
1 answer
Color is lost after adding string format
I need to add some text in a textview with some text with red color and some are black color with a specific formatting
Spannable wordtoSpan = new SpannableString(temp.substring(start, i));
wordtoSpan.setSpan(new ForegroundColorSpan(Color.RED), 0,…

Kaidul
- 15,409
- 15
- 81
- 150
0
votes
1 answer
Selection.setSelection can't get spanned
I am trying to create a ListView with linkes in it's view's. Just like the twitter app.
right now that's whats Im doing: I set in the TextView android:autoLink="all".
private static class TweetViewHolder {
public LinkifiedTextView text;
…

roiberg
- 13,629
- 12
- 60
- 91
0
votes
1 answer
setText method has no effect on EditText with dynamic setting MaskFilterSpan
environment: Android 4.2
layout/activity_main.xml

vv.dev.yyjn
- 1
- 1
0
votes
2 answers
Using linked spans in textview
I have a textview created in a class B programaticly. When class A calls it.
It adds text say "I went to the shop" and i need the word "the" to be a link. This i have done using this in CLASS B
sb.setSpan(new MyClickableSpan(Word), start,…

RuAware
- 979
- 1
- 9
- 26
0
votes
1 answer
Android get position of spannable in original html
If I know the position of a certain character in a spannable how to I get the corresponding position in the html? For example if I have the string:
example
and I know the letter 'p' is at position 4 in the spannable, how do I find out that…

odiggity
- 4,117
- 7
- 34
- 41
0
votes
1 answer
Spanned Textview HTML formatting only applies to last in loop?
I need to be able to loop through all my elements and set it to a Textview. However, I also need my numbers to be formatted to subscript. I tried doing so by using a loop but only the last number was formatted correctly.
For example, if I entered…

Pkmmte
- 2,822
- 1
- 31
- 41
0
votes
2 answers
SpannableStringBuffer limited to 9,999 characters?
My app reads in large amounts of data from text files assets and displays them on-screen in a TextView. (The largest is ~450k.) I read the file in, line-by-line into a SpannableStringBuffer (since there is some metadata I remove, such as section…

shmuelp
- 1,296
- 13
- 14
0
votes
2 answers
Text of Android button isn't displayed in the specified colour
I have a pretty simple problem. I'm creating several buttons with a method in an activity. However the text colour just remains in the standard colour (grey). I defined the following in my method:
Button b = new…

user1335772
- 277
- 1
- 3
- 10
0
votes
1 answer
Drawing spannable edittext content on the canvas
I have an EditText which contains smiley faces, the smiley faces are being added to the EditText as a spanable content,
I managed to draw the other things like "underline", "bold" and "italic", but I'm having trouble in drawing the bitmaps. Since…

Ali Alnoaimi
- 2,278
- 2
- 21
- 31
-1
votes
2 answers
using spannable to seperate words in a String
I DON'T WANT SPAN ON MY SPACES
I have a string, for example:
String items = " flowers chocolates candles ";
What I need to do is print this string like this:
Can I do this using spannable in Java? If yes, how ?
I have this RoundedBackgroundSpan…

Srijan
- 43
- 7
-1
votes
2 answers
Adding multiple smiles in TextView using ImageSpan
I am trying to add multiple smiles in textview using this code.
This is my TextView.

Muhammad Asim
- 379
- 1
- 4
- 14
-1
votes
1 answer
How to Bold (Span) the searched text in string dynamically?
I have a string, in which i have to find a word being searched from end user and make it bold to highlight.
Example:
String : Address must have a format. Address can be of multiple line.
Required Text: Address must have a format. Address can be…

Punit Sharma
- 2,951
- 1
- 20
- 35
-1
votes
1 answer
Get the location of a substituted format string substring in Android
I'm not quite sure how to word this so the title is a bit wierd. What I want to do is to colour and change the size of 2 subsituted substrings in a string that is in the format "%1$d/10 %2$s".
So say for example the first argument is '1' and the…

user3265561
- 812
- 7
- 22
-1
votes
2 answers
I have a String of sentence and a list of words that need to be highlighted if there is an occurrence in that String. How do I do that
I have a String of sentence and a list of words that need to be highlighted if there is an occurrence in that String.
How do I do that?

roshanthejoker
- 13
- 6
-1
votes
1 answer
How to implement spannable more than once in the following code?
##As spannable can't access data from outside of onclick listener, the whole code is written inside on click listener##
rd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int…

Sudhansu Swain
- 9
- 2