Utilizar el atributo HTML de tamaño en TextView

Tengo lo siguiente:

textView.setText(Html.fromHtml("<font color=\"red\" size=\"24\">Hello</font>")); 

La cadena 'Hello' se vuelve roja, pero el tamaño no cambia.

Es como si el atributo de tamaño es simplemente ignorado, ¿alguien sabe por qué esto es? ¿Estoy haciendo algo mal?

Sí, el atributo de tamaño simplemente ignorado. Sólo los atributos "color" y "cara" tienen en cuenta.

De fuentes de la clase Html :

 private void handleStartTag(String tag, Attributes attributes) { if (tag.equalsIgnoreCase("br")) { // We don't need to handle this. TagSoup will ensure that there's a </br> for each <br> // so we can safely emite the linebreaks when we handle the close tag. } ... else if (tag.equalsIgnoreCase("font")) { startFont(mSpannableStringBuilder, attributes); } ... } private static void startFont(SpannableStringBuilder text, Attributes attributes) { String color = attributes.getValue("", "color"); String face = attributes.getValue("", "face"); int len = text.length(); text.setSpan(new Font(color, face), len, len, Spannable.SPAN_MARK_MARK); } 

El atributo de tamaño no parece funcionar.

Puede utilizar <small> o <big> (varias veces para aumentar el efecto)

También puede usar <h1> a <h6> (sólo encabezado, es decir, agregar una nueva línea)

Su antigua moda, pero funciona bien!

Pruebe este, su trabajo para mí, el uso de pequeñas, grandes palabras clave

 TextView mBox = (TextView) findViewById(R.id.txt); mBox.setText(Html.fromHtml("<font color=#cc0029>" + "<b>" + "Hiiiiiiiiii" + "</b>" + "<br />" + "<small>" + "description" + "</small>" + "<br />" + "<small>" + "DateAdded" + "</small>")); 

Sergey Gotov tiene razón. La única forma de cambiar el tamaño del texto es usar las etiquetas h1h6 .

EDIT : También puede implementar TagHandler y utilizar sus propias etiquetas.

Mira Formateo y Styling en el sitio de desarrolladores de android:
http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling

O bien, en este antiguo post de StackOverflow:
Destacando el color del texto usando Html.fromHtml () en Android?

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.