android: set margin on PopupWindow by code
<p>I want to set left and right margins on popupwindow. I try setting layout params on <code>layout</code> , and then set margin , but not work.</p>

<p>Can anyone give me code for setting margin on popupwindow</p>

<p>Here is code</p>

<pre><code>LayoutInflater inflater = (LayoutInflater) QuestionsActiviy.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.popup, (ViewGroup) findViewById(R.id.popup_element));


        ratePw = new PopupWindow(layout);
        ratePw.setWidth(WindowManager.LayoutParams.FILL_PARENT);
        ratePw.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
        ratePw.setFocusable(true);

        ratePw.showAtLocation(layout, Gravity.CENTER, 0, 0);
</code></pre>

<p>Thanks.</p>
