how to change font in otpView
nashihu opened this issue · 4 comments
nashihu commented
hello, thanks for your great library
i would like to ask, how do i change font in otpView? i see there's attribute called app:text_typeface, but i dont know how to use it programmatically / directly from xml..
thank you
nashihu commented
i just check the code
val otpTextTypeFace = styles.getString(R.styleable.text_typeface)
...
if (otpTextTypeFace != null) {
try {
val tf = Typeface.createFromAsset(context.assets, otpTextTypeFace)
textView?.typeface = tf
} catch (e: Exception) {
e.printStackTrace()
}
}
so the answer is basicly put your font into assets folder, and then set app:text_typeface="YourFont.tff"
then it works.
thanks
ecemsuren commented
I did it like this but didn't work for me. Is there any solution to solve this?
thank you
nashihu commented
@ecemsuren i guess your problem caused by reference failure. can you please share your xml and font path?