An Android Spannable is an interface for text to which markup objects can be applied.
Questions tagged [spannable]
302 questions
0
votes
1 answer
How can I raise up the position of a particular character with Span?
There is a simple characters. "Hello → world!!!"
it's good to see it in XML Design tab. Nothing wrong.
but when i run the app, and the arrow is located at the baseline of TextView.
this is a xml code and design tab.
and the result when i run this…

CodingBruceLee
- 657
- 1
- 5
- 19
0
votes
1 answer
Using regular expressions to highlight links in a text (Linkify vs Patterns)
Why, with this approach, we will only use the last pattern:
Linkify.addLinks(someSpannable, Linkify.PHONE_NUMBERS)
Linkify.addLinks(someSpannable, Linkify.EMAIL_ADDRESSES)
In this case, both phone and email links will be…

Funrab
- 83
- 1
- 10
0
votes
1 answer
android: how to fix SpannableStrings from search in RecyclerView?
I have a SearchView set up on the top Toolbar in MainActivity. A user clicks on the search icon and then enters search character(s) from a soft keyboard. A ViewModel observer returns matching data from a Room database and then runs a setFilter()…

AJW
- 1,578
- 3
- 36
- 77
0
votes
0 answers
Android SpannableStringBuilder for multiple Patterns
I have different screens for different entities which are Products, Rooms, Posts, and, Users.
All of them have distinct ID which I use to open the particular screen to try to load the data from the ID parameter passed on the relevant screen/activity…

dan.darajat
- 53
- 5
0
votes
0 answers
when text is fully highlighted in one color switch activity
i am recreating a typing app for education purposes. The goal is to type the words of the paragraph. When a word is correct the word turns green, the editText field get cleared and its the next words turn. At the end every word is green and than the…

Zimooon
- 25
- 3
0
votes
1 answer
android No successful match so far
I'm trying to change the background color of a specific text e.g. this is the text xxxx 0 visible and I want to change background color of 0.
Here is my code
private TextView setTVBenutzername(View view, Question question, int groupPosition) {
…
user12790690
0
votes
0 answers
Prevent word-break when converting text to image using DynamicDrawableSpan
I'm trying to convert text to an image by changing each character of this text to an image, but I faced the word-break issue, I would like to make it return to a new line
e.g :
Should be :
Do it for
the
Aesthetic
Here's my code…

Mouaad Abdelghafour AITALI
- 4,007
- 7
- 27
- 54
0
votes
1 answer
Is it possible to add 2 colors on a single Android Spannable?
I do spell checking, and want to show all wrong letters in red.
Like the user typed Mossosoppo and the correct word would be Missisippi. I would want to show the wrong letters in red.
I tried with SpannedString, SpannableString and…

MatthiasL
- 81
- 6
0
votes
0 answers
When I split the char how can use spannable or ClickableSpan to get values?
When I split the char how can use spannable or ClickableSpan to get values?
this is a code
StringBuilder sb = new StringBuilder();
String data = newFeedModel.getFeedTags();
String[] items = data.split("#");
for…

James
- 3
- 3
0
votes
1 answer
Custom ImageSpan not displaying properly
I'm trying to create a custom class that extends ImageSpan because I need some kind of margin/padding on the spans.
What I figured I need to do is to override the getSize function to return a bigger width so the spans get graphically spaced.
The…

Lorenzo Benevento
- 522
- 1
- 3
- 16
0
votes
2 answers
How to change Specfic text's color using Regex, SpannableString in Android
Trying to change color of English text in EditText field's input.
Add Textwatcher in Edittext and call method in afterTextchanged method.
val regEng = Pattern.compile("[a-zA-Z]")
var editWatcher = object : TextWatcher {
override fun…

coooldoggy
- 47
- 5
0
votes
0 answers
Spannable not highlighting a word inside large text that is persian
Im trying to have a search function for a text view that shows a large text so when ever the user enters a word the word would be highlighted inside the text view and my code does work with english but not with persian.
my highlighting method
…

kasra
- 21
- 3
0
votes
0 answers
How to embed/integrate functionality for text formatting at run time in android app?
I am creating an Android application for Pets, people can place an ad to sell their pet, so, the user can type the description of the ad. But I want to embed/integrate text format system for the description(for example the user can bold, italic &…

Stack Overflow
- 1
- 5
- 23
- 51
0
votes
2 answers
Android Spanned text is blank on TextView
I am using Spanned object to process some HTML tags and showing the resulted text on TextView. But the Text is blank on TextView.
final Spanned output = Html.fromHtml(element.getText(), null,
new ElementTagHandler(element));
…

Sandy K
- 65
- 1
- 1
- 8
0
votes
0 answers
Why Spannable with icon inside is not displayed correctly ("obj" box is shown instead)?
I want to display an icon within text inside an EditText. I am using the following code snippet:
Html.ImageGetter imageGetter;
Spanned cs;
imageGetter = new Html.ImageGetter() {
public Drawable getDrawable(String source) {
…

P5music
- 3,197
- 2
- 32
- 81