CustomTextView : Custom font application with fonts suggestion in xml

MaKB
1 min readJul 11, 2018

--

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 :

  1. Create below CustomTextView.java
  2. Create attrs.xml and paste below code
  3. Download and paste respective fonts in assets folder
  4. Use CustomTextView in xml and apply app:fontname=”UbuntuRegular” property
  5. 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

If this post was helpful, please click the clap 👏 button below a few times to show your support!

--

--

MaKB
MaKB

Written by MaKB

Experienced software engineer with demonstrated history of working in telecommunications industry along with many other sectors like education, e-commerce etc.

No responses yet