Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change title size of alertdialog in android?

about text in the message there is not problem. I can't change (personalize) color, font, style of Title of alertdialog?

What's the way?

thanks!

like image 525
Pol Hallen Avatar asked Nov 12 '12 12:11

Pol Hallen


1 Answers

About font size you can use this:

SpannableStringBuilder ssBuilser = new SpannableStringBuilder("Sample");
StyleSpan span = new StyleSpan(Typeface.ITALIC);
ScaleXSpan span1 = new ScaleXSpan(1);
ssBuilser.setSpan(span, 0, 5, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
ssBuilser.setSpan(span1, 0, 5, Spanned.SPAN_INCLUSIVE_INCLUSIVE);

AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
   builder.setTitle(ssBuilser);
   builder.show();

or

AlertDialog dialog = new AlertDialog.Builder(this).setMessage("Hello world").show();
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
textView.setTextSize(40);
like image 172
Goofy Avatar answered Oct 19 '22 00:10

Goofy