androidfont-sizeandroid-fonts

How to change the Font Size in a whole Application programmatically, Android?


I have created Spinner with the list of Font Sizes from "8" to "46" . I could be able to click the font Size and in a spinner it has shown me .

My need is, if i click the Font Size "26" inside a Spinner then it should be applied to my whole project. Like applying to my Screen, Textview appearance, Edittext - Bold/ Italic, etc. Again if i click 46 size then it should be apply to my whole project.

How could i do this by programmatically ?


Solution

  • The probable solution would be you create a base class which extends TextView, and use this text view class as edit text. Hope you are asking for size in first screen. In any case, u set the text size in the base class. This will solve your problem.

    like u create this class in package com.example and class name is BaseTextView, then in xml file instead of <TextView .../> you will write <com.example.BaseTextView ... />

    Hope this helps.