samedi 11 juin 2016

Android: different formatting styles applied to one textview


I have one text view in my XML and in that text view i have a large number of text which i would like to apply different formatting styles to different text in the text view. Like center alignment,different fonts,different font size and underline.How do I achieve this? My sample code is below:

String [] item = {"Chicken BBQ bacon n n BBQ Chicken,Bacon,Sweet Corn,Onion n n <b>Regular</b> sh 500 n n Medium sh 700 n n Large sh 900 n n","Chicken and Mushroom n n chicken,mushroom n n Regular  Medium  Large n n sh500 sh700 sh900"}

description.setText(Html.fromHtml(item[x]));

Aucun commentaire:

Enregistrer un commentaire