I am trying to create app which provide text formatting (like font style , font size , font color). So I want default fonts provided by android as a list to be shown in drop-down. Selecting font from drop-down will change the Text dynamically. Can anyone help , how can I achieve this either via XML or programmatically ?
See the image how it must look like
To change the font, go to Settings > Display > Font size and style. Select your desired font in Font style to set it as the system font. On a OnePlus device, go to Settings > Personalisations > Font & display size. Here, you can select from two fonts: Roboto and OnePlus Sans.
MultiFontView library can be used to select custom fonts for the view dynamically in your XML. The library loads the custom fonts using a font cache.
font list is saved in Typeface
class as a static field Map<Stirng, Typeface> sSystemFontMap
. you just need to get this field. See my answer here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With