194

Is there a way to bold the text in a TextView via XML?

<TextView
   android:textSize="12dip"
   android:textAppearance="bold"  -> ??
</TextView>

Thanks

Syscall
  • 18,131
  • 10
  • 32
  • 49
user291701
  • 36,661
  • 70
  • 180
  • 281

6 Answers6

496

I have a project in which I have the following TextView :

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:text="@string/app_name"
    android:layout_gravity="center" 
/>

So, I'm guessing you need to use android:textStyle

Pascal MARTIN
  • 385,748
  • 76
  • 642
  • 654
  • I'm using like this with library `` style.xml `` **not applying bold** – Prasad Nov 03 '16 at 12:50
27

just use

android:textStyle="bold"
Nguyen Minh Binh
  • 22,901
  • 30
  • 113
  • 160
9

Example:

use: android:textStyle="bold"

 <TextView
    android:id="@+id/txtVelocidade"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/txtlatitude"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="34dp"
    android:textStyle="bold"
    android:text="Aguardando GPS"
    android:textAppearance="?android:attr/textAppearanceLarge" />
Héctor
  • 22,312
  • 29
  • 114
  • 225
Elton da Costa
  • 1,239
  • 15
  • 26
3

use textstyle property as bold

android:textStyle = "bold";
3

Use android:textStyle="bold"

4 ways to make Android TextView Bold

like this

<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="12dip"
android:textStyle="bold"
/>

There are many ways to make Android TextView bold.

Thomas Daniel
  • 217
  • 3
  • 6
0
Just you need to use 

//for bold
android:textStyle="bold"

//for italic
android:textStyle="italic"

//for normal
android:textStyle="normal"

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:text="@string/userName"
    android:layout_gravity="left"
    android:textSize="16sp"
/>
param
  • 391
  • 7
  • 17