Read complete story

Changing Font in the Application

We are often interested in the personalisation. When it comes to our desktop theme we reflect our taste. Same thing happens in case of application theming. We change style, fonts, colors, animation and like that. Changing font is also as important as other theming elements.

I was recently tasked with adding the ability to change font size when user changes the store.

Today we are gonna change the default theme of the application.

1. Custom Font Files

We can download free fonts available
banner(2)
e.g. https://www.google.com/get/noto/#kufi-arab 

2. Adding Font Files Applications

Remove the files from the .zip folder   assets /fonts under-copy.

For grade build the path will look like:

Screenshot_1

 

If you mistakenly choose different path, you will issues like

 

 3. Using the application elements on the Font File

First of all extends the Application and override the on Create Methods.

Hot Served Code for FontsOverride class:

 

Another way to achieve it is by using Custom Class.

Create a custom class

Now you can access this custom UI wherever we want. We can access it directly in XML or programmatically.

 

 

. . .

Comment (1)

Add Your Comment

  • Aman Gupta
    great Tut…..Shubham….easily understandable……
  • css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close