Put a bold word in an XML text

2

I've been looking and I've seen several solutions but they all go through something out of TextView , for example to use row separation and I use \n there is not something similar to put a single word (or several different ones) in bold font? In this case to try, put Text2 in bold.

<TextView
    android:text="Texto 1
    \n
    Texto2
    \n
    Texto3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/textView" />
    
asked by UserNameYo 11.02.2017 в 16:42
source

1 answer

2

There are several ways, for example using bold letter tag <b> , loading the text from strings.xml:

<string name="mi_mensaje"><![CDATA[Hola <b>mundo</b>, me llamo <b>Pepe</b>]]></string>

and loading the text to TextView with:

textView.setText(Html.fromHtml(getResources().getString(R.string.mi_mensaje)));

check this answer:

Bold in a part of a TextView

    
answered by 11.02.2017 / 21:45
source