I display a Popup based on an activity
MainActivity
btn_settings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openPopup();
}
});
private void openPopup() {
Intent popupwindow = new Intent(MainActivity.this, PopUpWindow.class);
startActivity(popupwindow);
}
PopUpWindow
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
getWindow().setLayout((int) (width*.9), (int) (height*.4));
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
getWindow().setBackgroundDrawableResource(R.drawable.bg_popup);
WindowManager.LayoutParams params = getWindow().getAttributes();
params.gravity = Gravity.CENTER;
params.x = 0;
params.y = 0;
getWindow().setAttributes(params);
To give you an idea the width*.9 must display a left and right margin of ~10dp and height*.9 must display 1/4 of the height of the phone
Behind the Popup you can see my MainActivity, I would like to know how to add a Blur around my popup
I also thought of a black background with ~80% transparency
If you have the solution for both it would be very appreciated but one will already be really great!!
Thanks you