reddit / IndicatorFastScroll

Android library providing a simple UI control for scrolling through RecyclerViews
MIT License
707 stars 58 forks source link

Support for custom font. #40

Open shrine2000 opened 3 years ago

shrine2000 commented 3 years ago

How to change the font and text color during runtime? If possible kindly help with code.

Screenshot 2021-01-10 at 23 57 53
DSteve595 commented 3 years ago

Kotlin:

fastScrollerView.textAppearanceRes = R.style.MyTextAppearance

Java:

fastScrollerView.setTextAppearanceRes(R.style.MyTextAppearance)
shrine2000 commented 3 years ago

The example you have show only work with style.xml. I want to apply custom font by selecting .ttf file from phone during runtime.

val typeface = Typeface.createFromFile(File(appPreferences.customFontPath)) textView.typeface = typeface

Checkout my github repo. I have created a demo of it - link

DSteve595 commented 3 years ago

Ah, you're totally correct. Should build a way to set this programmatically.