I want to set left and right margins on popupwindow. I try setting layout params on layout , and then set margin , but not work.
Can anyone give me code for setting margin on popupwindow
Here is 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);
Thanks.
as your layout is top on window, and you are doing this dynamically, by using width and height of screen, so to set margin 10 on sll side you can use: