spannablestring Questions

5

Solved

Can I use SpannableStrings in a widget's textView? I tried and all it rendered was plain text. I don't know if it is something I'm doing wrong (most likely), or if it just isn't possible for some r...
Hokum asked 4/6, 2012 at 20:4

4

It seems that in order to add an ImageSpan to a Spannable in Android, I have to actually replace some text with the Image. For example: Spannable span = new SpannableString("Foo imageplace Bar!");...
Graybeard asked 11/11, 2014 at 7:34

4

Solved

I want to change color of parts of a text several times with a timer. Simplest way is this: SpannableStringBuilder ssb = new SpannableStringBuilder(mainText); ForegroundColorSpan span = new Foreg...
Oldfashioned asked 1/2, 2014 at 9:3

4

Solved

I have two String resources as such: <string name="give_us_feedback">Give us feedback at %1$s if you want to make the app even better!</string> <string name="email">[email&#160...
Westney asked 15/5, 2014 at 9:45

6

Solved

Suppose you have the following string: String s = "The cold hand reaches for the %1$s %2$s Ellesse's"; String old = "old"; String tan = "tan"; String formatted = String.format(s,old,tan); //"The...
Pilpul asked 5/1, 2014 at 17:41

5

Solved

Suppose I have the next text : Hello stackOverflow And I wish to set the second word to be both RelativeSizeSpan (to set a relative font size) and TextAppearanceSpan (to set the color of the t...
Stoddart asked 20/2, 2013 at 13:41

7

Solved

When copying String from any browser page, pasteData works properly. However when copying SpannedString from a message sent item editor(field), the application crashes and shows this error message:...
Lees asked 15/12, 2014 at 7:26

3

Solved

I have textview with autoLink, but whenever i add custom span (ClickableSpan) to textview its auto link to web url and mobile number is not working. is there any easy way to solve this issue. Style...
Limitative asked 8/9, 2017 at 8:5

6

Solved

i have a 3 String like this: "@Username: Deliverd your order", "YOU got trophy: KING OF COINS", "There is a package waiting for you to pick up from #surat to #mumbai", what i wanted to do is ge...
Finale asked 5/9, 2017 at 9:22

3

Solved

Background Suppose I use SpannableStringBuilder to append multiple stuff into it, and one of them is string that I format from the strings.xml file, which has a span inside: SpannableStringBuilde...

5

Solved

I have a problem with a SpannableString object. Below's a short example: SpannableString spanstr = new SpannableString("Bold please!"); spanstr.setSpan(new StyleSpan(Typeface.BOLD), 0, spanstr.le...
Eolithic asked 17/4, 2013 at 13:11

8

I set background in string like that: spanString.setSpan(new BackgroundColorSpan(color), 0, 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); But I would like to increase left and right padding in this back...
Bugbane asked 19/11, 2013 at 10:54

4

Solved

I have a problem statement where i need to run my application with Accessibility setting on, to have talk back feedback, but the problem here is when i click on a TextView which have Spannable link...

1

I am using localization in my app. english : `<![CDATA[Makan <b>daging</b> adalah terlalu banyak karbohidrat]]>` indonesia : `<![CDATA[Eating <b>meat</b> is too muc...
Russia asked 2/12, 2021 at 4:2

1

Solved

As we know, AnnotatedString in JetpackCompose has provided some API of Android's SpannedString. but I didn't find any way/workaround to inline ImageSpan to a Text (except using AndroidView)

11

Solved

I need to create a String placed in a TextView that will display a string like this: First Part Not Bold BOLD rest not bold So I want to know how I could use SpannableStringBuilder to do this?...
Oliverolivera asked 31/5, 2012 at 6:0

4

Solved

I seem to be getting what seems like some extra line breaks after using this method to set the text of a TextView message.setText(Html.fromHtml( message )); How can I remove these? They cause my...
Unrobe asked 15/3, 2014 at 2:23

4

I need to create a custom text-view in android, first of all it should be justified, then it should support spans and although it should support RTL (Right to Left) languages for ex: Farsi (Persian...

2

Solved

I was trying to remove style from my SpannableString but unfortunately is not working, my aim is to remove the style when I click on the text. SpannableString content = new SpannableString("Te...
Weiman asked 5/11, 2015 at 2:33

0

I try to compare two SpannableStrings texts on my unit test and I receive the error: java.lang.RuntimeException: Method toString in android.text.SpannableString not mocked. See http://g.co/androids...
Mervin asked 12/4, 2021 at 15:12

4

Solved

So, as most of you know, there is no text justifying inside a TextView in Android. So, I built a custom TextView to get around the problem. However, for some reason, sometimes punctuation marks bre...
Titanate asked 5/6, 2017 at 11:51

2

Currently, I wish to add an image in between texts and align it to the top of the TextView. Something like this: The only vertical alignments I can find are baseline (which seems to put it righ...
Schrecklichkeit asked 5/12, 2013 at 5:32

4

Solved

I tried this: String s = "Some big string" SpannableStringBuilder sb = new SpannableStringBuilder(s); //normal font for 1st 9 chars sb.setSpan(robotoRegular, 0,9,Spannable.SPAN_INCLUSIVE_INCLUSIVE...
Godspeed asked 27/11, 2012 at 6:40

3

I am developping a Flutter app which uses a Textfield. I am declaring the TextField like this : new TextField( controller : _controller, decoration : new InputDecoration( hintText: 'Message......
Rudder asked 21/5, 2017 at 11:31

2

Solved

I am trying to get All Spans applied to text as below; public String getTextWithTags(Editable e) { StyleSpan[] ss = e.getSpans(0,e.length(),StyleSpan.class); ss[0].getSpanStart <--- ? This i...
Ares asked 25/8, 2015 at 11:39

© 2022 - 2025 — McMap. All rights reserved.