0

I want body text to appear above a list of views inside dialog from MaterialAlertDialogBuilder. I tried setting body text and adapter but it only resulted in showing the body text, ex1.

MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(-)
builder.setMessage(R.string.ex1)
builder.setAdapter(adapter, new OnClickListener() { - }
Javlon
  • 1,108
  • 2
  • 15
  • 29
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 19 '23 at 07:45

1 Answers1

0

You can use setTitle method of the MaterialAlertDialogBuilder.

MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder( - )
builder.setTitle(R.string.ex1)
builder.setAdapter(adapter, new OnClickListener() { - }
Javlon
  • 1,108
  • 2
  • 15
  • 29
  • Thanks for the suggestion but I want different text for the title and body. – haru_bleu Apr 18 '23 at 20:49
  • You can achieve what you want by applying style to the body text and adapter text. But for things like this I prefer custom dialog :) – Javlon Apr 18 '23 at 20:53