Cómo configurar TextAppearance programáticamente

I'm trying to set the TexAppearance of a TextView programmatically. I've look at SetTextApparence and at the TextView constructor 3rd parameter.

I can set one of Android style:

lvTextView.SetTextAppearance(Context, Android.Resource.Style.TextAppearanceMedium); 

But I cannot figure how to set my own app style. What is the syntax to reference my styles?

preguntado el 09 de septiembre de 13 a las 21:09

1 Respuestas

Supposing your style is like this:

<style name="MyStyle" parent="@android:style/Widget.TextView">
    <item name="android:textStyle">bold</item>

You can set the TextView's appearance programatically as:

TextView textViewTitle = (TextView) findViewById(R.id.text_view_title); // Your TextView
textViewTitle.setTextAppearance(this, R.style.MyStyle);

Respondido el 09 de Septiembre de 13 a las 22:09

This is only prior to API level 23, from API level 23 textViewTitle.setTextAppearance(R.style.MyStyle); - Igor Vukovic

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.