Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get android default font list programmatically?

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

enter image description here

like image 753
Pallavi Avatar asked May 09 '16 11:05

Pallavi


People also ask

How do I find my default font on Android?

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.

Which library is used in font management in Android?

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.


1 Answers

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.

like image 150
liao Avatar answered Nov 01 '22 11:11

liao