To make text in your TextView Bold or Italic in Android Programming we need to make use of attribute android:textAppearance. It can have three values normal, bold and Italic.

Android TextView Bold and Italic.png
Example 1 : Bold
<TextView
android:id="@+id/tvBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This line is in Bold"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
Example 2 : Italic
<TextView
android:id="@+id/tvItalic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This line is in Italic"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="italic" />
Example 3: Bold and Italic
<TextView
android:id="@+id/tvBoldnItalic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This line is in Bold and Italic"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold|italic" />
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:ignore="HardcodedText" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="This line is in Italic"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="italic" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="202dp"
android:text="This line is in Bold"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:text="This line is both Bold and Italic"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold|italic" />
</RelativeLayout>

Android TextView Bold and Italic.png
More Posts related to Android,
- Change Android Toast background color
- Maven : java.lang.ClassNotFoundException: Xmx512m
- This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) Lint Error
- Android Alert Dialog with Checkboxes example
- Android Error Generating Final Archive - Debug Certificate Expired
- How to add Newline to text in Android TextView
- Read Text file from SD Card : Android Programming
- [FIX] AndroidRuntime: FATAL EXCEPTION: main - java.lang.RuntimeException NullPointerException
- ActivityManager Warning: Activity not started, its current task has been brought to the front
- INSTALL_FAILED_INSUFFICIENT_STORAGE Android Error
- Android Developers Bluetooth Tutorial
- java.lang.ClassNotFoundException android.support.v7.widget.Toolbar [Fix]
- Android: Save Data in local Db using Android Room
- Channel 50 SMSes received every few minutes Android Phones
- 21 Useful Android Emulator Short-cut Keyboard Keys
- Changing Android Intent Tittle using java code
- Android : No Launcher activity found! Error
- How to change TextView or EditText Text Color on Focus and on Press
- How to display Toast on Button Click : Android
- Android : Execute some code after back button is pressed
- Stop android adb service from command prompt or terminal
- [Soluiton] You already have the latest version of Android Studio installed
- Create Custom Android AlertDialog
- Android R Cannot Be Resolved To A Variable
- How to make Android EditText not editable
More Posts:
- What is CA FE BA BE 00 00 00 3D in Java Class Bytecode - Java
- Common Microsoft Teams sign in errors and how to fix - Teams
- Portable Notepad++ for windows - NotepadPlusPlus
- Twitch chat down, error loading data, content unavailable, streaming problem - News
- How to check if a port is in use using terminal [Linux or macOS] - MacOS
- How to enable Do Not Disturb mode for Notification Center in Mac OS X 10.10 Yosemite - Mac-OS-X
- Using Java 8 Month Enum with Examples - Java
- Change Android Toast background color - Android