I want to change the font of the title of Alert Dialog box.
Can anybody tell how can I do it?
Instead of setting the text of the alertdialog, you should set a custom view form your layouts. And before you do so, modify your view's font. try this example
TextView content = new TextView(this);
content.setText("on another font");
content.setTypeface(Typeface.SANS_SERIF);
//Use the first example, if your using a xml generated view
AlertDialog.Builder myalert = new AlertDialog.Builder(this);
myalert.setTitle("Your title");
myalert.setView(content);
myalert.setNeutralButton("Close dialog", null);
myalert.setCancelable(true);
myalert.show();
code for xml...replace your font in the xml
<TextView
android:id="@+id/yourid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="your content" />
Try setting theme for the dialog. Change the typeface attribute like this :
<style name="CustomDialog" parent="android:Theme.Dialog">
<item name="android:typeface">serif</item>
</style>
Though this changes Fonts of all the textviews within the dialog. so make sure TextViews are set to proper typeface