Textview - Leave only one word in Bold

Asked

Viewed 1,978 times

0

I have a TextView which displays the following text on the screen:


Like this:

value:
PROMOTION!


As I wish:

value:
PROMOTION!


Has as put Bold in just one word from TextView? I mean, there’s a way I can do this without raising two TextView, one with Bold, one without Bold.

I’d like to use just one.


Code:

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Valor:\nPROMOÇÃO!"
        android:id="@+id/textView"
        android:layout_gravity="left|top"
        android:layout_marginTop="70dp"
        android:layout_marginLeft="15dp"
        android:textSize="15dp"
        android:textAlignment="center"
        android:gravity="center_horizontal"
        android:textColor="#42a56b" />

2 answers

3


android:text="@string/promotion"

<string name="promotion">valor:<br /><b>PROMOÇÃO!</b></string>

  • He brought the information on the screen but did not migrate to Bold in the word.

  • see if it helps http://stackoverflow.com/questions/14371092/how-to-make-a-specific-text-on-textview-bold

  • see if the answer to that question http://answall.com/questions/94795/comorcolocar-texto-negrito-em-string-xml-do-android is not your case.

0

Dude, I don’t think there’s any way to change the style of just one word inside the text view. When you set the property it will put all the component text in this format.

Couldn’t you just use two or three Textviews? That is, you would separate the part of the text you want to put as bold in a separate Textview, with this property set.

  • AP explicitly says that it wants an alternative to use more than one Textview.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.