Android
Dialog
No Title
UI Design
Android Development

Android How to create a Dialog without a title?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Creating a dialog without a title in Android is usually simple: either do not set a title at all when using AlertDialog, or explicitly request the no-title window feature for a custom Dialog. The exact approach depends on whether you are using a standard alert or a fully custom dialog layout.

No title with AlertDialog

If you use AlertDialog.Builder, the easiest way to have no title is simply not to call setTitle().

kotlin
1AlertDialog.Builder(this)
2    .setMessage("Delete this item?")
3    .setPositiveButton("Delete", null)
4    .setNegativeButton("Cancel", null)
5    .show()

Because no title is set, the dialog appears without one.

Custom dialog with FEATURE_NO_TITLE

If you are using a custom Dialog, request the no-title feature before setting the content view.

kotlin
1val dialog = Dialog(this)
2dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
3dialog.setContentView(R.layout.custom_dialog)
4dialog.show()

The order matters. If you call requestWindowFeature too late, it may not take effect.

Using a dialog theme without a title

Another clean option is to apply a no-title dialog theme:

xml
<style name="NoTitleDialogTheme" parent="Theme.MaterialComponents.Dialog">
    <item name="windowNoTitle">true</item>
</style>

Then create the dialog with that theme:

kotlin
val dialog = Dialog(this, R.style.NoTitleDialogTheme)
dialog.setContentView(R.layout.custom_dialog)
dialog.show()

This works well when the same no-title styling should be reused across multiple dialogs.

Material dialogs and custom views

If your project uses Material Components, MaterialAlertDialogBuilder is usually the better starting point than a raw platform dialog. You can still avoid a title and provide your own content view.

kotlin
1val content = layoutInflater.inflate(R.layout.dialog_profile_actions, null)
2
3MaterialAlertDialogBuilder(this)
4    .setView(content)
5    .setNegativeButton("Close", null)
6    .show()

This gives you Material styling without forcing a title bar. It is also easier to keep button spacing, typography, and shape appearance aligned with the rest of the app.

DialogFragment is often a better container

In modern Android code, DialogFragment is usually safer than directly managing raw dialog lifecycles from an activity because it integrates better with lifecycle changes and configuration events.

You can still use the same no-title techniques inside a DialogFragment, but the hosting pattern is more robust.

Why the title area sometimes seems to remain

Developers sometimes remove the title text but still see extra top spacing. That usually comes from the dialog theme, default paddings, or the layout placed inside the dialog rather than from a real title widget still being shown.

If you use a custom layout, inspect the root padding and any top margin in the first child view. The issue is often visual spacing, not an Android failure to remove the title.

Keep the dialog visually intentional

Removing the title is not just a technical step. Make sure the dialog content still has enough context. If the title is gone, the message body, icon, or custom layout should clearly communicate what the dialog is about.

No-title dialogs work best when the content already carries the meaning.

Common Pitfalls

  • Calling setTitle and then wondering why the dialog still has a title.
  • Requesting Window.FEATURE_NO_TITLE after the content view or show call.
  • Using a custom dialog with no title and also no clear content heading, leaving the UI ambiguous.
  • Reaching for a raw Dialog when a DialogFragment would handle lifecycle better.
  • Mixing theme-based no-title styling with runtime title configuration and getting inconsistent results.

Summary

  • For AlertDialog, the simplest no-title solution is not calling setTitle().
  • For custom dialogs, use requestWindowFeature(Window.FEATURE_NO_TITLE) before setting content.
  • A no-title dialog theme is a reusable alternative.
  • 'DialogFragment is often the better modern container for dialog UI.'
  • Removing the title should still leave the dialog content clear and intentional.

Course illustration
Course illustration

All Rights Reserved.