TextView bold via XML file?

AndroidTextviewResources

Android Problem Overview


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

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

Thanks

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

just use

android:textStyle="bold"

Solution 3 - Android

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" />

Solution 4 - Android

use textstyle property as bold

android:textStyle = "bold";

Solution 5 - Android

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.

Solution 6 - Android

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"
/>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser291701View Question on Stackoverflow
Solution 1 - AndroidPascal MARTINView Answer on Stackoverflow
Solution 2 - AndroidNguyen Minh BinhView Answer on Stackoverflow
Solution 3 - AndroidElton da CostaView Answer on Stackoverflow
Solution 4 - AndroidSarnath JegadeesanView Answer on Stackoverflow
Solution 5 - AndroidThomas DanielView Answer on Stackoverflow
Solution 6 - AndroidparamView Answer on Stackoverflow