Questions tagged [spannable]

An Android Spannable is an interface for text to which markup objects can be applied.

302 questions
1
vote
0 answers

How to achieve scrollable TextView with custom popup on ClickableSpan at span location?

As shown in above image(subview of some screen), I want to achieve the scrollable text content(from dynamic json data) in which I have color & linked span. Once user clicked on this span I want to show popup as shown in reference image(consider…
jignesh.world
  • 1,396
  • 1
  • 11
  • 26
1
vote
1 answer

Android: ClickableSpan on the last word of TextView works not properly

I use this excellent hashtag lib: https://github.com/danylovolokh/HashTagHelper However, there is a bad behavior in this case: hello it's my last #word If the last ClickableSpan matchs with the last word in the TextView, then if I don't click in…
anthony
  • 7,653
  • 8
  • 49
  • 101
1
vote
0 answers

Android remove Span from SpannableString

My target is to remove last span from SpannableString. I have created SpannableString like this: String simple = (String) label.getText(); String colored = " * "; SpannableStringBuilder builder = new…
IntoTheDeep
  • 4,027
  • 15
  • 39
  • 84
1
vote
1 answer

What the best way to display html in the recyclerView?

In the recyclerView I display comments. Comments are stored as HTML. I tried to display the comments in webView - all displayed well (with the ability to use custom *.css) but recyclerView significantly retarding while scrolling. And I was not able…
Mikhail
  • 2,612
  • 3
  • 22
  • 37
1
vote
2 answers

Is it possible inserting Image into TextView using string argument approach?

As we see in https://stackoverflow.com/a/10144094/3286489, we could add arguments into our String parameter through the %1$d etc. But I don't know how to add image there. We could add image to our String as we see in…
Elye
  • 53,639
  • 54
  • 212
  • 474
1
vote
1 answer

Android: Trying to change color from string using Spannable (partially working)

I have string called note. I put this code to change the color of specific words between two * * characters. It partially works fine. The issue I am facing is not coloring to yellow the exact words between * * after I inserted this symbol "➥ " (an…
Holly Ikki
  • 199
  • 1
  • 10
1
vote
2 answers

indent bulleted lines in android TextView

Will someone please help me figure this out? I have a TextView that is supposed to contain a number of bulleted lines. If a given line is too long, I need it to wrap indented. How do I do that? Here is my code, which obviously isn't doing what I…
Nouvel Travay
  • 6,292
  • 13
  • 40
  • 65
1
vote
2 answers

set background for only a part of TextView

For example, I have a textview (multi line): aaaaaaaaabbbbaaa. I want to set background for only 'bbb' characters. I try to use Spannable but it doesn't work with my background is a image from drawable. Many thanks.
Truong Vu
  • 204
  • 4
  • 14
1
vote
1 answer

Remove style on spans

I have used this StyleSpanRemover to remove style from selected text, but i have a problem. I want to have a bold button that toggle bold style of selected text. it means if the selected text (or part of that) is not bold, bold all of them; and if…
Mostafa Lavaei
  • 1,960
  • 1
  • 18
  • 27
1
vote
0 answers

Android -- SpannableStringBuilder not affecting TextView

I'm trying make a registered trademark symbol into a superscript with the following code: public static void formatSuperscript(TextView itemTitle) { String title = itemTitle.getText().toString(); SpannableStringBuilder sb = new…
Sean Thomas
  • 129
  • 12
1
vote
1 answer

how can I set drawable background just to a number string into another string in android?

is there any way to set background (xml circular drawable) to a number or any string between another string ? I have (for example) this text in the textView (copied from stackoverflow): You are setting the text on bookDisp(I guess that this is the…
Simon
  • 147
  • 2
  • 10
1
vote
0 answers

Save all the spans associated with a Spannable?

I use a Spannable + EditText to create a RichText Editor. I have already implemented the Editor. Now I need to save the content to a file (Don't tell me the html method) So I plan to save the plain text separately and all the Spans separately. How…
SadeepDarshana
  • 1,057
  • 18
  • 34
1
vote
0 answers

TextView: set Html and own SpannableStringBuilder

I have a string that contain html tags. So for set text into TextView I use: textView.setText(Html.fromHtml(myString)); It's works good. Also I have own method convertText() with type SpannableStringBuilder. In which method I convert text, where I…
user3499878
  • 1,023
  • 2
  • 10
  • 15
1
vote
0 answers

Prevent typing in SearchView before SpannableString

Inside android SearchView i made a TextView and added "This Site" to it then converted the view to bitmap and added span using a shape drawable. I dont want my cursor to type before the Span and setSelection doesn't seems to work for me final…
1
vote
1 answer

Use spannable to highlight only part of already added text

I add a text like this: tv.setText("This is text created with StringBuilder"); Then I track which word a user longclicks on, and want to highlight that word for some short period of time: tv.setOnLongClickListener(new OnLongClickListener() { …
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488