I want to make a TextView
's content bold, italic and underlined. I tried the following code and it works, but doesn't underline.
<Textview android:textStyle="bold|italic" ..
How do I do it? Any quick ideas?
I want to make a TextView
's content bold, italic and underlined. I tried the following code and it works, but doesn't underline.
<Textview android:textStyle="bold|italic" ..
How do I do it? Any quick ideas?
Or just like this in Kotlin:
Or in Java:
Keep it simple and in one line :)
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:textStyleMind you that to use the mentioned
bolditalic
you need to, and I quote from that pageso you'd use
bold|italic
You could check this question for underline: Can I underline text in an android layout?
This is an easy way to add an underline, while maintaining other settings:
For bold and italic whatever you are doing is correct for underscore use following code
HelloAndroid.java
main.xml
string.xml
Programmatialy:
You can do programmatically using setTypeface() method:
Below is the code for default Typeface
and if you want to set custom Typeface:
XML:
You can set Directly in XML file in like: