Questions tagged [android-spannable]

33 questions
27
votes
2 answers

Create TypeFaceSpan from TypeFace below SDK version 28

I found a way to create TypeFaceSpan from TypeFace like this : fun getTypeFaceSpan(typeFace:TypeFace) = TypeFaceSpan(typeFace) But this API is allowed only in API level >= 28 . Any Compat libray to achieve this below 28?
erluxman
  • 18,155
  • 20
  • 92
  • 126
3
votes
0 answers

How can I draw a zigzag underline on a specific text of an EditText, similar to a spell-check underline?

Description: I want to be able to draw a zigzag line span on a text with a given start and end position of an EditText in Android. I have tried using a custom ReplacementSpan class to draw the zigzag line, but when I try to modify the underlined…
Abdo21
  • 498
  • 4
  • 14
3
votes
1 answer

ReplacementSpan - "chips" across lines

I'm using a custom replacement span to draw a background around particular words (adds padding around the words, words are identified by surrounding symbols, much like an HTML tag), and to even change the text size of those words (although I'm not…
Mark
  • 2,362
  • 18
  • 34
3
votes
3 answers

How to apply the background color for the ImageSpan in Android?

I want to apply the background color for the Image span dynamically in Android. Could you please suggest any ideas?
Deva
  • 150
  • 2
  • 2
  • 17
2
votes
0 answers

Disable darkmode for textColor edittext

disabled the dark mode for the application with false But in the input in the case, when you need to remove Span, the textСolor is reset to white and becomes invisible. Пример: text: Editable? start:…
2
votes
0 answers

how to handle textview span style bold issue with langs having semi-characters(like hindi matra: ा ि ी ु) being seperated out?

I need to style some part of text in a TextView like making bold etc. I'm supporting multiple languages but facing an issue when the languages have dependent semi-characters like matra in Hindi which are dependent on other characters. ex : Hindi…
2
votes
0 answers

Is there any option to include loader(progress bar) for some of the text in Android TextView?

I have created a new android application and want to support encryption for important data. I show those encrypted text in textview like '*****' and onClick event of the text (I'm using clickable span for click event as only some part of the text is…
sathish
  • 91
  • 6
2
votes
1 answer

Making text Bold, Italic and Underscore with Dynamic string

I'm currently trying to figure out how to make text bold, Italic or underline with dynamic string coming from API, the text which has to be bold is coming as * bold *, Italic coming as _ italic_ and underline as #underline# (Same functionality as…
W4R10CK
  • 5,502
  • 2
  • 19
  • 30
1
vote
1 answer

How to Save ImageSpan with text into SQL Lite Database?

I have implemented image in EditEtxt. Its working fine. I want to save the whole editText entities(Text & image) in sql lite database. When i save it to sql only text are showing not images. I also tried with Html.toHtml and Html.fromHtml. Its also…
1
vote
1 answer

not able to apply span to first letter in a word

I am working on an animation that involves setting OutlineSpan to individual letter in a word . However when i apply the OutlineSpan to first letter its not reflecting val string = "f" val spannableString = SpannableString(string) val outlineSpan =…
Ayush Bansal
  • 702
  • 1
  • 7
  • 17
1
vote
5 answers

Kotlin set two different text styles to dynamically changing text in a text view using SpannableString

I have a text view with a value that can change. For example, it's Pressure. It can have different length - i.e. 999.1 or 1010.2 hPa. The text looks like this: I need to set different text styles for the first part of the text (the number -…
Lilya
  • 495
  • 6
  • 20
1
vote
1 answer

BulletSpan which has newline is not working in Android

i'm using BulletSpan which is customized. i want to display long text that has '\n'. every lines are fine except for the text line which has '\n'. bulleetspan can't apply the indent to the newline text. this is the result. and the last text is one…
CodingBruceLee
  • 657
  • 1
  • 5
  • 19
1
vote
1 answer

How to add Annotation tags to a String programmatically

In this video Google gave an example for formatting portions of a String based on Annotation tags that can be used to set a key/value pairs in a String within strings.xml. Here is an example for this: strings.xml Hello…
Zain
  • 37,492
  • 7
  • 60
  • 84
1
vote
2 answers

Spannable text that holding custom view

Is that possible to add a custom view into a spannable text? In android.text.style package I can see many types of spannable objects, but I wonder if I can add a custom view. Sort of spanable.setSpan(CustomView, .. , .. ,..) Note that: CustomView…
Ibrahim Ali
  • 1,237
  • 9
  • 20
1
vote
1 answer

Changing english character color in red with edittext

Trying to change edittext's input color when character is alphabet. so I added textWatcher in edittext and check it with regex. It looks like working OK-ish but doesn't work when input String start with English. When input's first String start with…
1
2 3