Tôi muốn đặt lề trái và phải trên popupwindow. Tôi thử đặt thông số bố cục trên layout
và sau đó đặt lề, nhưng không hoạt động.android: đặt lề trên PopupWindow theo mã
bất cứ ai có thể cho tôi mã cho thiết lập lề trên popupwindow
Đây là mã
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);
Cảm ơn.
ratePw không hỗ trợ addView – Jovan
Hãy thử điều này: 'ratePw.update (int Left_Margin, int Top_Margin, int Width, int Height); 'điều chỉnh chiều rộng để nó hoạt động –
Chúng tôi không thể cung cấp lề cho các tham số bố cục trong popupwindow. Công việc này aint. Tôi đã thử các giải pháp trên từ jeet và làm việc của nó như một say mê (với vài điều chỉnh mặc dù). –