1

How could we set the font style of a progress dialog to the Default System Font? Also, how could we set it to the Normal size?

Thank you.

Cemil Tatoglu
  • 65
  • 1
  • 10

1 Answers1

0

Well there is an example to change font size and color of Progress Dialog programmatically:

SpannableString ss=  new SpannableString(title);
ss.setSpan(new RelativeSizeSpan(2f), 0, ss.length(), 0);  
ss.setSpan(new ForegroundColorSpan(Color.RED), 0, ss.length(), 0); 
SpannableString ss1=  new SpannableString("String");
ss1.setSpan(new RelativeSizeSpan(2f), 0, ss1.length(), 0);  
ss1.setSpan(new ForegroundColorSpan(Color.GREEN), 0, ss1.length(), 0); 

ProgressDialog pd = new ProgressDialog(this);
pd.setTitle(ss1);
pd.setMessage(ss2);
pd.show();

And for getting system's font try below code. MAy be it will work:

Settings.System.getFloat(getBaseContext().getContentResolver(),
                Settings.System.FONT_SCALE, (float) 1.0);

Check here for details: Read font size from Settings

Community
  • 1
  • 1
Android Geek
  • 8,956
  • 2
  • 21
  • 35