2

so I've been working on a project for a client and I'm new to Android development, so maybe it's an easy question.

The client wants to have several options in his app settings, and he wants to change those options via a SwitchView. The options are:

  • increase the font size 40% in the whole app
  • change the font family to a dyslexic font (in the whole app)

I've searched all over the internet and haven't found a way to do this during runtime. So far I've made a dyslexic font family which I included in a theme in styles.xml. If there really isn't an easy way to do this, is there maybe a way to show an alert dialog or something like that where the user confirms the change and then the app restarts with the applied changes.

If you ask me the font size setting doesn't make any sense because the size is dependable on the Accessibility system setting, so if some's got the biggest font setting why would he need to make it even bigger since it's only logical that the setting he's got set in his system suits him enough.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
shiba117
  • 21
  • 1
  • My 2 cents: You could save a boolean (say: isBigger) in your preferences. When you read it back, have a global variable which is normally set to 1.0 and set it to 1.4 (40% bigger) if the boolean is true. Then use it as a multiplier for your font size. – Phantômaxx Nov 10 '20 at 12:10
  • Check this link. I hope you will get your answer. https://stackoverflow.com/questions/33923803/how-to-set-custom-font-for-a-whole-application-in-android – asad ghaffar Nov 10 '20 at 12:14

1 Answers1

0

I suggest you change the font in the whole of the app use this library: Calligraphy

and for text size, you can create a customTextView class and extend it from TextView and add your custom method to change textSize or fontFamily, and finally use this class instance TextView.

m.sajjad.s
  • 711
  • 7
  • 19