¿Es posible tener múltiples estilos dentro de un TextView?

¿Es posible establecer múltiples estilos para diferentes fragmentos de texto dentro de un TextView?

Por ejemplo, estoy configurando el texto de la siguiente manera:

tv.setText(line1 + "\n" + line2 + "\n" + word1 + "\t" + word2 + "\t" + word3);

¿Es posible tener un estilo diferente para cada elemento de texto? Por ejemplo, línea 1 negrita, palabra 1 cursiva, etc.

La guía del desarrolladorTareas comunes y cómo hacerlas en Android incluyeSeleccionar, resaltar o aplicar estilo a partes del texto:

// Get our EditText object.
EditText vw = (EditText)findViewById(R.id.text);

// Set the EditText's text.
vw.setText("Italic, highlighted, bold.");

// If this were just a TextView, we could do:
// vw.setText("Italic, highlighted, bold.", TextView.BufferType.SPANNABLE);
// to force it to use Spannable storage so styles can be attached.
// Or we could specify that in the XML.

// Get the EditText's internal text storage
Spannable str = vw.getText();

// Create our span sections, and assign a format to each.
str.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, 7, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
str.setSpan(new BackgroundColorSpan(0xFFFFFF00), 8, 19, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
str.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 21, str.length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

Pero eso usa números de posición explícitos dentro del texto. ¿Hay una forma más limpia de hacer esto?

Respuestas a la pregunta(17)

Su respuesta a la pregunta