Android TextView – Italic Text

Italic Text in TextView

To change the text style in TextView widget to italic, set the textStyle attribute of the widget to italic value.

The default value of textStyle attribute for TextView is normal. When you change it to italic, the text in TextView appears bold.

<TextView
	android:textStyle="italic"
	android:text="Italic Text" />
Android TextView - Italic Text

Example

Create an Android Application with Kotlin support and Empty Activity. Create two TextView widgets with different text styles. One with bold style and the other with normal style.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="20dp"
        android:textSize="30sp"
        android:textAlignment="center"
        android:textStyle="bold"
        android:text="Bold Text" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="20dp"
        android:textSize="30sp"
        android:textAlignment="center"
        android:textStyle="normal"
        android:text="Normal Text" />

</LinearLayout>

MainActivity.kt

package com.kotlinandroid.myapp

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}

Screenshot

Android TextView - Italic Text - Example