PopWindow.isShowing()不起作用的原因

 PopupWindow dialog = new PopupWindow(layoutView, LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        dialog.setBackgroundDrawable(getResources().getDrawable(android.R.color.transparent));
        dialog.setOutsideTouchable(true);
        dialog.setFocusable(true);
        dialog.showAsDropDown(parentView, 1, 0);
        dialog.update();

 

要使dialog.isShowing()(判断PopWindow是否已显示在屏幕上)起作用,需要获取焦点,dialog.setFocusable(true);这句要加上

posted @ 2014-10-22 10:14  蓝色漩涡  阅读(1098)  评论(0)    收藏  举报