This question has been asked before: AlertDialog custom title has black border
But was not answered satisfactorily - and is missing some information.
I
Just to make Steve's answer more clear, this can be done easily. For example in my case the view I was setting in the dialog was a WebView.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
WebView webView = new WebView(getActivity());
webView.loadUrl(" url to show ");
OnClickListener clickListenerOk = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
...
}
};
OnClickListener clickListenerCancel = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
...
}
};
AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setPositiveButton("OK", clickListenerOk)
.setNegativeButton("Cancel",clickListenerCancel)
.create();
dialog.setView(webView, 0, 0, 0, 0);
return dialog;
}