Search code examples
androidkotlinandroid-typeface

Custom TypeFace in Kotlin Programmatically


How to set typeface of any TextView. Using java we do something like this

TextView tv = (TextView) findViewById(R.id.custom);
tv.setTypeface(null, Typeface.BOLD);

How such operation could be performed while using kotlin. Which will be the efficient way to do this in kotlin? Is there any better way provided with kotlin?

holder.itemView.title.typeface = ?

Solution

  • Thanks after lot of research i solved it in single line

    holder.itemView.title.typeface = Typeface.DEFAULT_BOLD
    

    Hope it helps someone else !!