Hi, what if we can set custom font from xml itself. also we can add additional attribute to customise textview from xml to avoid redundant code from java classes.
Steps to do :
- Create below CustomTextView.java
- Create attrs.xml and paste below code
- Download and paste respective fonts in assets folder
- Use CustomTextView in xml and apply app:fontname=”UbuntuRegular” property
- Done.
Create attrs.xml in values folder
Usage in activity_main.xml
Find detail project repo here to download..
https://github.com/manojbhadane/CustomTextView
Thanks