Is it possible to style a single, say, TextView in Android with multiple alternating styles, colors, and sizes?
Think in-line HTML or CSS but in the Android world.
As an extreme, to demonstrate the point, let’s say I wanted to have a word “CIRCUS” with each letter being a different color.
Do I have to create six different TextViews for this, or can it be done in one?
I don’t think there is something inherent in the View that allows for defining several different styles to be applied to different parts of the View, but you can apply different markup within a View through Spannables.
It isn’t a very general solution, but at least for TextViews, the
setTextmethod accepts a spanned string.