See doco for setText() in TextView http://developer.android.com/reference/android/widget/TextView.html
To style your strings, attach android.text.style.* objects to a SpannableString, or see the Available Resource Types documentation for an example of setting formatted text in the XML resource file.
Programmatically: Run time
You can do programmatically using setTypeface():
textView.setTypeface(null, Typeface.NORMAL); // for Normal Text
textView.setTypeface(null, Typeface.BOLD); // for Bold only
textView.setTypeface(null, Typeface.ITALIC); // for Italic
textView.setTypeface(null, Typeface.BOLD_ITALIC); // for Bold and Italic
XML: Design Time
You can set in XML as well:
android:textStyle="normal"
android:textStyle="normal|bold"
android:textStyle="normal|italic"
android:textStyle="bold"
android:textStyle="bold|italic"
Hope this will help
Summved
try this line of code.
textview.setTypeface(textview.getTypeface(), Typeface.DEFAULT_BOLD);
here , it will get current Typeface from this textview and replace it using new Typeface. New typeface here is DEFAULT_BOLD
but you can apply many more.
i found textView.setTypeface(Typeface.DEFAULT_BOLD);
to be the simplest method.
Like Jonathan suggested, using textView.setTextTypeface
works, I just used it in an app a few seconds ago.
textView.setTypeface(null, Typeface.BOLD); // Typeface.NORMAL, Typeface.ITALIC etc.
Depending on which style you want to set, you have to use different methods. TextAppearance stuff has its own setter, TypeFace has its own setter, background has its own setter, etc.
TextView tvCompany = (TextView)findViewById(R.layout.tvCompany);
tvCompany.setTypeface(null,Typeface.BOLD);
You an set it from code. Typeface
Source: Stackoverflow.com