Cómo configurar TextAppearance programáticamente
Frecuentes
Visto 6,809 veces
5
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?
1 Respuestas
6
Supposing your style is like this:
<style name="MyStyle" parent="@android:style/Widget.TextView">
<item name="android:textStyle">bold</item>
...
</style>
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
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas android xamarin.android textview or haz tu propia pregunta.
This is only prior to API level 23, from API level 23 textViewTitle.setTextAppearance(R.style.MyStyle); - Igor Vukovic