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);这句要加上。
浙公网安备 33010602011771号