我正在尝试为AlertDialog
设置自定义字体系列,但Android
指出以下内容:
Cannot resolve method setTypeface(android.graphics.Typeface)
以下是我的代码:
TextView settingsTitle = new TextView(this);
settingsTitle.setText("Settings");
settingsTitle.setPadding(20, 20, 20, 20);
settingsTitle.setTextSize(20);
settingsTitle.setTypeface(Typeface.MONOSPACE);
AlertDialog settingsDialog = new AlertDialog.Builder(this)
.setCustomTitle(settingsTitle)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// continue with delete
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
Typeface standardFont = Typeface.MONOSPACE;
settingsDialog.setTypeface(standardFont);