Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] Android HTML span inside span doesn’t cascade style

Posted on November 11, 2022 By

Solution 1 :

Is it OK for you to use it like this without using spans.

String text = "normal text here<font color=#fc4903>this should be red</font> <font color=#ffcc00>but this should be yellow</font><font color=#fc4903>and more red text</font>now normal text ";
textview.setText(Html.fromHtml(text))

Sorry if I misled you.

Problem :

I want to use HTML to color segments in a TextView. I have:

String myText = "normal text here <span style='color: red'> this should be red <span style='color: yellow'>but this should be yellow </span> and more red text </span> now normal text";
textView.setText(Html.fromHtml(myText, 0));

However the text “but this should be yellow” is still red. I even tried

<span style='color: yellow !important'>

And it’s still red. How can I enforce the yellow part?

READ  [FIXED] java - android - Comparing two very large ArrayLists one of them retrieved from firebase
Powered by Inline Related Posts
Android Tags:android, html, textview

Post navigation

Previous Post: [FIXED] java – How can I solve this Android Studio Firebase problem?
Next Post: [FIXED] Android Java Publish result cast issue at MyCustomAdapter.java

Related Posts

[FIXED] android – How to disable Swipe left and up in RecyclerView? Android
[FIXED] c# – How to link a onClick event of a button inside activity_main.xml file of a .Net Xamarin.Android project? Android
[FIXED] java – On Map Long Click listener is not placing a marker on my G Map, can you help me? Android
[FIXED] java – How do to make a stopwatch thread? Android
[FIXED] When Android use msf: after select a file Android
[FIXED] android – How to use View Binding on custom views Android

Archives

  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can Vicks humidifier be used without filter?
  • What color is Spanish green?
  • How old is Jamie in The War That Saved My Life?
  • When should I use scalp massager for hair growth?
  • Can I put polyurethane over liming wax?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme