parthi
parthi

Reputation: 125

how to set layout background transparent show popup window in android?

I would like to be able to either blur or dim the layout background when I show my popup window Like this.how do this pls help me.

This my code:

LayoutInflater inflater = (LayoutInflater) ResidentActivity.this
                            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    View layout = inflater.inflate(
                            R.layout.activity_appselection,
                            (ViewGroup) findViewById(R.id.popuplayoutelement));
                    pwindo = new PopupWindow(layout, 470, 540, true);
                    pwindo.showAtLocation(layout, Gravity.CENTER, 0, 45);

my output show this

enter image description here but i need like this enter image description here

Upvotes: 2

Views: 8458

Answers (1)

qazimusab
qazimusab

Reputation: 1051

Declare the main parent in your layout like this for example:

RelativeLayout rl = (RelativeLayout)findViewById(R.id.relativeLayout);

Then when you show your popup also add this statement.

rl.setAlpha(0.5F);

This will set alpha to 50% in the layout. You can tweak as necessary.

Upvotes: 5

Related Questions