1

I'm tried to blur background using this post: https://stackoverflow.com/a/21278278/10837992.

It's work good but i have a little problem with the size of the dialog.

  1. I'm created custom layout :

  2. I'm changed the realization of the method.

                    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                    LayoutInflater inflater = this.getLayoutInflater();
                    View dialogView = inflater.inflate(R.layout.alert_dialog_layout, null);
                    builder.setView(dialogView);
                    TextView title = dialogView.findViewById(R.id.Title);
                    TextView desc = dialogView.findViewById(R.id.Desc);
    
                    title.setText("Title");
                    desc.setText("Desc");
                    AlertDialog alert = builder.create();
    
    
                    Bitmap map = new BlurUtils().takeScreenShot(getActivity());
                    Bitmap fast = new BlurUtils().fastblur(map, 50);
                    final Drawable drawable = new BitmapDrawable(getResources(), fast);
    
                    alert.getWindow().setBackgroundDrawable(drawable);
                    alert.show();
    
  3. While running this method, the size of the Dialog is cropped: Screenshoot: enter image description here

Michael
  • 429
  • 5
  • 22

1 Answers1

0

Ok , I find a solution:

Just added Theme to AlertDialog.Builder.

AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(),android.R.style.Theme_DeviceDefault_Light_NoActionBar_Fullscreen);
Michael
  • 429
  • 5
  • 22