Clicking spinner within popup window causes WindowManager$BadTokenException

前端 未结 4 1564
你的背包
你的背包 2020-12-11 21:34

I\'ve looked up a couple of posts for the same problem but can\'t seem to resolve my issue. I\'ve used spinners throughout my application and they are working fine. It\'s wh

4条回答
  •  自闭症患者
    2020-12-11 21:50

    Can you try by replacing following line:

    pw_references = new PopupWindow(vg_references, 
        this.getWindowManager().getDefaultDisplay().getWidth()/100 * 75,
        this.getWindowManager().getDefaultDisplay().getHeight()/100 * 50,
        true);
    

    with

    pw_references = new PopupWindow(this);
    pw_references.setWidth(this.getWindowManager().getDefaultDisplay().getWidth()/100 * 75);
    pw_references.setHeight(this.getWindowManager().getDefaultDisplay().getHeight()/100 * 50);
    pw_references.setContentView(vg_references);
    

    where this refer to the current activity reference. Just to see if this make any difference...

提交回复
热议问题