'SpannableStringBuilder only keeping formatting for the first for loop
I am trying to use a for loop to add formatting using SpannableStringBuild
from strings in a list, however in the TextView
, despite all the strings having been appended, only the string appended in the initial for loop keeps its formatting.
Solution 1:[1]
As we can't reuse instance of formatting style twice, all that had to be done was move the declaration of the formatting such as UnderlineSpan underlineSpan = new UnderlineSpan();
inside the for loop.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tamzid |