Android Italic Typeface
Solution 1:
Use setTypeface(Typeface)
from the Java code or android:textStyle
from the XML layout. They should do the trick, if you want all your text to be italic.
Edit:
In that case, I would think that your font doesn't have italic style, by default. From the documentation of the setTypeface(Typeface)
method:
Sets the typeface and style in which the text should be displayed. Note that not all Typeface families actually have bold and italic variants, so you may need to use setTypeface(Typeface, int)
to get the appearance that you actually want.
Do you use custom font? Try
mTextView.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC), Typeface.ITALIC)
Solution 2:
This should be all:
textView.setTypeface(null, Typeface.BOLD_ITALIC);
textView.setTypeface(null, Typeface.BOLD);
textView.setTypeface(null, Typeface.ITALIC);
Solution 3:
From the docs on TextView ...
public void setTypeface (Typeface tf, int style) Since: API Level 1
Sets the typeface and style in which the text should be displayed, and turns on the fake bold and italic bits in the Paint if the Typeface that you provided does not have all the bits in the style that you specified.
Post a Comment for "Android Italic Typeface"