0

I implemented a DialogFragment with single choice list, a custom view with a checkbox and a positive and negative button in this way:

  @Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), ThemeUtils.getDialogTheme(getActivity()));
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.simple_layout_with_checkbox, null);
    builder.setTitle(getContext().getString(R.string.categories))
            .setSingleChoiceItems(categories, 0, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                   //...
                }
            });

    builder.setPositiveButton(getContext().getString(R.string.apply), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            //...
        }
    });
    builder.setNegativeButton(R.string.cancel, null);
    builder.setView(v);
    return builder.create();
}

obtaining this in portrait: portraint

but in landscape I got this: enter image description here

As you can see, buttons are checkbox are disappeared. I think the issue has to do with listview height that does not let enough space for other views.

I would like to get rid of this behavior and allow my dialog do appear entirely (with buttons and checkbox).

TheModularMind
  • 2,024
  • 2
  • 22
  • 36

0 Answers0