草庐IT

android:通过代码在 PopupWindow 上设置边距

我想在弹出窗口上设置左右边距。我尝试在layout上设置布局参数,然后设置margin,但不起作用。谁能给我在弹出窗口上设置边距的代码这是代码LayoutInflaterinflater=(LayoutInflater)QuestionsActiviy.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);Viewlayout=inflater.inflate(R.layout.popup,(ViewGroup)findViewById(R.id.popup_element));ratePw=newPopupWindow(layo