How to set font weight programmatically?


I want to change the font weight in TextView but i can’t find the required method.

How can i do it without creating a new font?


I have found the right answer. There is the static method:

open static fun create(family: Typeface?, weight: Int, italic: Boolean): Typeface

For example, if you want the font weight to be 700:

var text = findViewById<TextView>(

Answered By – Yan

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published