1

when I button Click, show AlertDialog.

but clicked button, show title bar. I want remove title bar. so I try

builder.requestWindowFeature(Window_FEATURE_NO_TITLE);

but requestWindowFeature cannot resolve symbol error.

Android Dialog: Removing title bar

I reference this site.

but my source not work. my source not activity only class.

How to fix this problem?

hyunwooks
  • 141
  • 3
  • 14

3 Answers3

1

You can create a custom Dialog and use is to show the alert. Something like below should work

    Dialog dialogView = new Dialog(mActivity, android.R.style.ThemeDeviceDefaultLightNoActionBar);

    dialogView.setContentView(R.layout.custom_alert_layout);
    dialogView.show();

The above will also enable you to make any customizations that you would like your alert to display.

Pooja Gaonkar
  • 1,546
  • 17
  • 27
1

Try instead:

builder.requestWindowFeature (Window_FEATURE_NO_TITLE);

use this:

builder.supportRequestWindowFeature (Window.FEATURE_NO_TITLE);
V.March
  • 1,820
  • 1
  • 21
  • 30
0

You are requesting the feature on the builder, not on the dialog. call the requestWindowFeature(Window_FEATURE_NO_TITLE) after you call the create() method on the builder, which returns an AlertDialog and then call requestWindowFeature(Window_FEATURE_NO_TITLE). And you should request the feature before setting the view of the dialog. You can request the feature in onCreate of the dialog like getDialog().requestWindowFeature(Window_FEATURE_NO_TITLE)

Sony
  • 7,136
  • 5
  • 45
  • 68