Questions tagged [spannable]

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

302 questions
1
vote
1 answer

Android clickable span click activate all TextView not only spannable text

Good afternoon. Could you help me with a clickable span? The fact is that when I assign a clickable substring at the end of an origin String, not only the text becomes clickable, but also the entire TextView area to the right of the substring, which…
1
vote
3 answers

How to dynamically change part of string's color with SpannableBuilder

I am formatting strings dynamically, as the following example from Android documentation: Hello, %1$s! You have %2$d new messages. Then I set values like this: var text = getString(R.string.welcome_messages,…
Viktor Vostrikov
  • 1,322
  • 3
  • 19
  • 36
1
vote
0 answers

Android: how to clear Spannable color in Recyclerview with ViewModel?

The Adapter code below for the RecyclerView successfully highlights user entered text (using an EditText line linked to a SearchView) to the color Green. public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { String…
AJW
  • 1,578
  • 3
  • 36
  • 77
1
vote
0 answers

Set Span (Especially AbsoluteSizeSpan) at Empty EditText

How can I Set Span (Especially AbsoluteSizeSpan) at Empty EditText? I can make it if there's only one letter, but I can't make if there's no letter. Also, I wanna ask you some question : for (AbsoluteSizeSpan as : spannable.getSpans(k, k + 1,…
1
vote
1 answer

SetMovementMethods - ScrollingMovementMethod with LinkMovementMethod

I am new to Android Studio/Java.I have composed a script which creates a TextView contains a number of lines of information. I want to make each line clickable, to create a Toast dialog for example, which content relevant to that entry. This I can…
1
vote
1 answer

Thread slows down over time

I am trying to make a rainbow colored title (which changes with time), here is the onCreate: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); new…
Guy Sharon
  • 47
  • 7
1
vote
0 answers

CharSequence passed through intent arrives modified

I'm sending a CharSequence of a Spannable to another Activity via intent extras, but seem not to receive the same sequence. I'm doing that according to the following answer: https://stackoverflow.com/a/45638248/1545435 Here's the content of…
Ambran
  • 2,367
  • 4
  • 31
  • 46
1
vote
1 answer

Spannable text in TextView not showing properly

I had this code working fine, but when updating the build tools and libraries from 26.0.2 to 27.0.3, the TextViews started to cut the text. There are 4 TextViews in a LinearLayout. Each TextView has a width 0dp and a weight of 1. All TextViews have…
Ziad Halabi
  • 964
  • 11
  • 31
1
vote
1 answer

Why is Spannable fromHtml giving me wrong incorrect output if the first quote is escaped? It removes the first sentence

I am pretty new to Android. I am able to reproduce my issue with a very simple example. I have the following in my strings.html:

1
vote
1 answer

Android - set color of text before typing text in EditText

I have EditText and 3 color selection boxes. I want to select a color and then start typing the text in EditText. Currently, I am only able to write the text, select it and then change the color of the text. I have tried following but hasn't…
user427969
  • 3,836
  • 6
  • 50
  • 75
1
vote
1 answer

Justify text inside Android Textview

I want to Justify text inside Android TextView. With copy and share function and can accept spannable string. Can someone help me. It's so important for me. Thank you in advance
1
vote
1 answer

searchview result in listview, but not highlight the result

I have created a searchview, when i type a word and press ENTER from the keyboard, the results show on a listview in 3 or 4 seconds. so i want to insert a progres spinner till the result populated. And Also I want to try to highlight the search…
Noor Hossain
  • 1,620
  • 1
  • 18
  • 25
1
vote
0 answers

LeadingMarginSpan not indented correctly for multilevel/nested bullets

I create a custom BulletSpan by extending LeadingMarginSpan to draw a custom bulleted items in a TextView. The documentation of LeadingMarginSpan says it can be nested (i.e. multilevel bullets): There can be multiple leading margin spans on a…
fikr4n
  • 3,250
  • 1
  • 25
  • 46
1
vote
3 answers

Android - how to build a custom textview that has money with superscript aligned with dollar value

I would like to build a custom textview that can show money like this: In the end I want any user to be able to call it like this:
j2emanue
  • 60,549
  • 65
  • 286
  • 456
1
vote
1 answer

Change the selected/unselected text colour of a specific Tab in a TabLayout with an index (only style one tab)

Currently I am trying to style one Tab in a TabLayout differently to the rest. I would like one Tab with a specific index to have red text, both selected and unselected. As I am only requiring this for only one Tab at a specific index, the usual…
edwoollard
  • 12,245
  • 6
  • 43
  • 74