AccentAlertDialog doesn't work without message
MariusVolkhart opened this issue · comments
When creating a AccentAlertDialog
without a message, the divider does not get painted.
Code causing problem:
AlertDialog dialog = new AccentAlertDialog.Builder(getActivity())
.setTitle(R.string.prompt_confirm)
.setPositiveButton(R.string.button_yes_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do stuff
}
})
.setNegativeButton(R.string.prompt_no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do stuff
}
})
.show();
new DividerPainter(getActivity()).paint(dialog.getWindow());
The activity is an AccentFragmentActivity
as per the Wiki.
Adding a message solves the problem.
Indeed, the divider shouldn't be there at all. I guess that if you use AlertDialog in stead of AccentAlertDialog, you will have no divider at all. Did you try that?
I did and it still has the header when used with the AccentActivity. This happens both w/ and without the explicit use of the DividerPainter
.
However, when using the normal AlertDialog with a normal activity, it also has the divider across the top, so it's "supposed" to be there, though this might be a framework issue. I'd say that this issue can be closed.
I agree, it seems like it is a platform "issue". Well, I actually think that we are just not supposed to display a dialog without any content.
If you absolutely want this effect, you can add a textview as the dialog content and format it to meet your needs.
In any case, I think we can close the issue. In my opinion it falls out of the scope of this library.