我的来源
private static final int ALERT_DIALOG = 1;
@Override
public void onBackPressed() {
// buildAlertMessageExit();
showDialog(ALERT_DIALOG);
}
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
if (id == ALERT_DIALOG) {
ContextThemeWrapper ctw = new ContextThemeWrapper(this,
R.style.AlertDialogCustom);
AlertDialog.Builder builder = new AlertDialog.Builder(ctw);
builder.setMessage("Hello World")
.setTitle("Alert Dialog")
.setIcon(android.R.drawable.ic_dialog_alert)
.setCancelable(false)
.setPositiveButton("Close",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
dialog.dismiss();
}
});
dialog = builder.create();
}
if (dialog == null) {
dialog = super.onCreateDialog(id);
}
return dialog;
}
样式.xml
<style name="AlertDialogCustom" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@null</item>
<item name="android:windowFrame">@null</item>
</style>
结果没有主题