Setting the textview font size programatically is a simple procedure. For doing the same you can follow the below code:
Programmatically set text as bold,italic or underline :
by Using Typefrace: textView.setTypeface(null, Typeface.BOLD_ITALIC);
textView.setTypeface(null, Typeface.BOLD);
textView.setTypeface(null, Typeface.ITALIC);
textView.setTypeface(null, Typeface.NORMAL);
by Using HTML tags:
String text = "Bolded text, italic text, even underlined!"
TextView tv = (TextView)findViewById(R.id.THE_TEXTVIEW_ID);
tv.setText(Html.fromHtml(text));
Hope the above code will work. Please let me know if you face any problem here.
Programmatically set text as bold,italic or underline :
by Using Typefrace: textView.setTypeface(null, Typeface.BOLD_ITALIC);
textView.setTypeface(null, Typeface.BOLD);
textView.setTypeface(null, Typeface.ITALIC);
textView.setTypeface(null, Typeface.NORMAL);
by Using HTML tags:
String text = "Bolded text, italic text, even underlined!"
TextView tv = (TextView)findViewById(R.id.THE_TEXTVIEW_ID);
tv.setText(Html.fromHtml(text));
Hope the above code will work. Please let me know if you face any problem here.
0 comments:
Post a Comment