I would like to know how to construct an if statement to check if a TextView is bold or italic. Please help. Thank you.
http://developer.android.com/reference/android/widget/TextView.html#getTypeface()
public Typeface getTypeface ()
returns:
the current typeface and style in which the text is being displayed.
if(yourTextViewInstance.getTypeface()!=null){
if(yourTextViewInstance.getTypeface().getStyle()==Typeface.BOLD || yourTextViewInstance.getTypeface().getStyle()==Typeface.ITALIC){
//do your stuff
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With