How to open a alertDialog without darkening the screen?

Asked

Viewed 51 times

1

I have this alertDialog:

private void createInfoWindow() {
    AlertDialog.Builder alert = new AlertDialog.Builder(activity);
    alert.setCancelable(true);
    alert.setView(R.layout.middle_window_adapter);
    alert.show();
}

How do I make the screen behind not darken?

1 answer

1

You can declare his background as transparent

For example:

AlertDialog.Builder alert = new AlertDialog.Builder(activity);
    alert.setCancelable(true);
    getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    alert.setView(R.layout.middle_window_adapter);
    alert.show();
  • It didn’t work. The screen behind the Alert should not fade.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.