Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to span a textview in layout itself in android?

Can I span a textview to make some part bold in the layout itself. I have around 20 xml files. I am not using any activity for them, so I cannot do it programatically. So is there a way to specify it in xml layout itself. I have already tried using between them but it doesn't works.

android:text="Lets look how to make <b> negative sentences <b> in simple present tense."

doesn't work.

like image 792
Abhinav Avatar asked Nov 03 '22 16:11

Abhinav


1 Answers

You can style a textView in xml but I believe it has to be a string resource rather than a hardcoded value like you are doing. Move the string to strings.xml and access it using resource id

 android:text="@string/name"

Check this post.

Quoted from the post:

Supported HTML elements include:

<b> for bold text.
<i> for italic text.
<u> for underline text.
like image 116
nandeesh Avatar answered Nov 14 '22 16:11

nandeesh