Quiero establecer los márgenes izquierdo y derecho en popupwindow. Intento configurar parámetros de diseño en layout
, y luego establezco el margen, pero no trabajo.android: establecer el margen en PopupWindow por el código
Puede alguien darme el código para establecer el margen de popupWindow
Aquí está el código
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);
Gracias.
ratePw no compatible addView – Jovan
Pruebe esto: 'ratePw.update (int Left_Margin, int Top_Margin, int Ancho, int Height);' ajuste el ancho para que funcione –
No podemos asignar márgenes a los params de diseño en popupwindow. Esto no es trabajo Probé la solución anterior de jeet y funciona como un amuleto (aunque con algunos ajustes). –