Sunday, 4 June 2017

How to set the font style to bold, italic and underlined in an Android TextView?



I want to make a TextView's content bold, italic and underlined. I tried the following code and it works, but doesn't underline.





How do I do it? Any quick ideas?


Answer




I don't know about underline, but for bold and italic there is "bolditalic". There is no mention of underline here: http://developer.android.com/reference/android/widget/TextView.html#attr_android:textStyle



Mind you that to use the mentioned bolditalic you need to, and I quote from that page




Must be one or more (separated by '|') of the following constant values.




so you'd use bold|italic




You could check this question for underline: Can I underline text in an android layout?


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...