You should not use the isShowing() method of PopupWindow as the switch for showing and hiding, because if you have not called the showAsDropDown method, the return value of isShowing() must be false. You can customize a temporary boolean as a display switch, such as boolean isPopShowing=false; and then reset the display status through the method of isPopShowing=!isPopShowing
Either the place where you output the log is wrong, or your wPopupWindow.showAsDropDown method has not been called at all.
/**
* <p>Indicate whether this popup window is showing on screen.</p>
*
* @return true if the popup is showing, false otherwise
*/
public boolean isShowing() {
return mIsShowing;
}
public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
。。。
mIsShowing = true;
。。。
You should not use the isShowing() method of PopupWindow as the switch for showing and hiding, because if you have not called the showAsDropDown method, the return value of isShowing() must be false. You can customize a temporary boolean as a display switch, such as boolean isPopShowing=false; and then reset the display status through the method of isPopShowing=!isPopShowing
Either the place where you output the log is wrong, or your wPopupWindow.showAsDropDown method has not been called at all.