Start a Project

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

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:

 

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.

 

 

Exit mobile version