Sumit Shukla
Sumit Shukla

Reputation: 4494

Font-family usage in android

font/lobster.xml

<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
    <font
        android:fontStyle="normal"
        android:fontWeight="400"
        android:font="@font/lobster_regular" />

    <font
        android:fontStyle="italic"
        android:fontWeight="400"
        android:font="@font/lobster_italic" />

    <font
        android:fontStyle="bold"
        android:fontWeight="600"
        android:font="@font/lobster_bold" />
</font-family>

Upvotes: 0

Views: 784

Answers (1)

RobCo
RobCo

Reputation: 6495

In your xml use

android:fontFamiliy="@font/lobster"
android:textStyle="italic"

Or in code

textview.setTypeface(textview.getTypeface(), Typeface.ITALIC);

Upvotes: 1

Related Questions