Android移除PopupWindow背景

问题描述

| 我使用PopupWindow类创建自定义弹出窗口。 但是当我在main上添加layout_margin(在我的示例中为15dp)时,会有透明的灰色背景。 如何删除透明背景? 请看图片 编辑 这是我的代码
    window = new PopupWindow(customTool.getContext());
    window.setWidth(WindowManager.LayoutParams.FILL_PARENT);
    window.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    window.setTouchable(true);
    window.setFocusable(true);
    window.setoutsidetouchable(true);
    window.setAnimationStyle(R.style.Animations_PopDownMenu_Left);
window.setContentView(customTool);
    window.showAtLocation(customTool,Gravity.NO_GraviTY,100);
    

解决方法

        嗯-尝试在弹出对话框中设置尝试 yourDiag.setBackgroundDrawable(null);